Django Rest Framework. What is queryset and serializer_class?
Let's say I have the following viewset:
queryset = Category.objects.all()
serializer_class = CategorySerializer
I am wondering what does the queryset and serializer_class do here? I can assume queryset is about how the models' order will be displayed (such as ordering, filtering and so on), but I may be wrong. Please correct me, and, if possible give broad explanation.
queryset this to select data from database, you can select all data or apply filter or what you want, in more basic way.. where to write your database query using Django ORM
serializer where the queryset will serialize like convert it to json object to use it in response for example, because some ORM query will return QuerySet not a json object
this a basic explained for both, you can check for more details in Django RestFramework Serializer