If that API is accessed via AJAX, then your JS code needs translate status 302 and Location header to JS code that sets "location.href"
Regards, Aldian Fazrihady http://aldianfazrihady.com On Sat, 24 Aug 2019, 17:49 göktürk sığırtmaç, <s.goktur...@gmail.com> wrote: > 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+unsubscr...@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 > <https://groups.google.com/d/msgid/django-users/d9369cce-3734-4bff-ac53-ce785918362b%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAN7EoAZfY%2B%3D9_Qk%2BGC2vmCaAj_STxRqM4Hf832cEWEySi6WN0w%40mail.gmail.com.