Saturday, August 24, 2019

Django Redirect Not Working

Hello, my UserCreate class is create user via CreateAPIView. I want to check. if user is auth, auth user directly to 'profile' URI. 

class UserCreate(generics.CreateAPIView):

serializer_class = UserCreateSerializer
permission_classes = (~IsAuthenticated,)
queryset = User.objects.all()

def __init__(self):
if IsAuthenticated:
print("hello")
redirect("profile/")

code above is working print method but not working redirect method.

--
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/d9369cce-3734-4bff-ac53-ce785918362b%40googlegroups.com.

No comments:

Post a Comment