It seems that you have both the serializer_class
member object and the get_serializer_class method set. Remove the serializer_class. On Thursday, November 21, 2019 at 8:21:44 PM UTC-5, Cristian Benavides Jimenez wrote: > > Hi everybody, > > I try use a two serializers in one view inherits from *GenericViewSet* > with the method *get_serializer_class* > > Here a little piece of my code: > > class RandomViewSet(ListModelMixin, GenericViewSet): > permission_classes = (IsAuthenticated, ) > filter_backends = [filters.SearchFilter, filters.OrderingFilter, ] > search_fields = ['some_field', 'some_field', 'some_field', ] > ordering_fields = ['pk', ] > ordering = ['pk', ] > lookup_field = 'pk' > serializer_class = OneSerializer > serializers = { > 'list': OneSerializer, > 'create': TwoSerializer, > } > > def get_serializer_class(self, *args, **kwargs): > print('THIS METHOD DON\'T WORK') > return self.serializers.get(self.action) > > > def create(self, request, *args, **kwargs): > > print('Data is not validated :(') > > > > > Any help for this? > > Greetings, > > > -- You received this message because you are subscribed to the Google Groups "Django REST framework" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/de6e0e13-4830-4195-8fc8-7a1183fbbed2%40googlegroups.com.