You probably just want to use the login_required decorator.
https://docs.djangoproject.com/en/2.1/topics/auth/default/#the-login-required-decorator
-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On
Behalf Of ???
Sent: Wednesday, February 6,
I want to write a function 'get_user_or_log_in' to check whether the user has
logged or not. If logged, return user's name, if not, redirect to the login
page. I want to use it like function 'get_object_or_404'. But I do not know how
to let django response at my own function not just at the
2 matches
Mail list logo