[x] I have verified that that issue exists against the master branch of Django REST framework.
[x] I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
[x] This is not a usage question. (Those should be directed to the discussion group instead.)
[x] This cannot be dealt with as a third party library. (We prefer new functionality to be in the form of third party libraries where possible.)
[x] I have reduced the issue to the simplest possible case.
[x] I have included a failing test as a pull request. (If you are unable to do so we can still accept the issue.)
Steps to reproduce
I have a custom RawSQL with inner join.
I create a custom class object Category (this is not created in models.py):
class Category(object):
def __init__(self, **kwargs):
for field in ('id', 'budget', 'concept', <my other fields>):
setattr(self, field, kwargs.get(field, None))
then I create a serializer class
class CategorySerializer(serializers.Serializer):
# attributes
def create(self, validated_data):
return Category(id=None, **validated_data)
def update(self, instance, validated_data):
for field, value in validated_data.itens():
setattr(instance, field, value)
return instance
Checklist
master
branch of Django REST framework.Steps to reproduce
I have a custom
RawSQL
with inner join.I create a custom class object
Category
(this is not created in models.py):then I create a serializer class
The next step is create the view:
also add it into routes:
Now, I get my json response correctly.
I based in this tutorial in how implement a custom model for serializer only:
Expected behavior
But I have a doubt in how to implement a pagination in my RawSQL, someone ha ve any idea how write the code correctly to add pagination
Actual behavior
I get my json :
without pagination class, how can I implement a pagination with RawSQL?
thanks.