Wednesday, December 11, 2019

Re: Code Inspect

Hi,

You may need refer to ModelViewSet class that inherit from GenericAPIView class 




On Wed, Dec 11, 2019, 16:38 Soumen Khatua <soumenkhatua258@gmail.com> wrote:
class UserViewSet(viewsets.ModelViewSet):
    queryset = get_user_model().objects
    serializer_class = UserSerializer

    def get_permissions(self):
        if self.request.method == 'POST':
            self.permission_classes = (AllowAny,)

        return super(UserViewSet, self).get_permissions()


I didn't understand this code,So i have some questions like:

In this Case I'm overriding ModelViewSet get_permissions class,right?

After overriding self.permission_classes variable,I'm returning Parent
class(ModelViewSet) get_permissions(), Which method(properties)
will come after calling UserViewSet.

Thank You in advance

Regards,
Soumen

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPUw6WbEBaiizem-Gi2zh5gT1kRpdf-zM75_op2pYOebwTANXw%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAP5HUWpqLWg22Bo6rKEZSfNt%3DvzSPUcJAwEinThMid1envSmjQ%40mail.gmail.com.

No comments:

Post a Comment