from django.shortcuts import HttpResponseRedirect
class ExampleView(TemplateView):
template_name = 'pages/example.html'
def get(self, request):
if not request.user.is_authenticated:
return HttpResponseRedirect('login')
On Wed, Sep 25, 2019 at 1:09 PM saeed albooyeh <saeedalbooyeh@gmail.com> wrote:
--hii used CreateView for registration in my project and i wanna prevent authenticated user from accessing to the register url and redirect it to another pagecan anyone tell me how can i do it?
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/53f16488-e8d6-4992-8446-99a857e5dd5b%40googlegroups.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/CAE_sR8vRvbbT6qW5N6MgX%2BB8cCVv9aXLfdJmQyR8YGkZj%3DhyvA%40mail.gmail.com.
No comments:
Post a Comment