How to return a http response at my own function

9 views
Skip to first unread message

肖子聪

unread,
Feb 6, 2019, 6:54:46 AM2/6/19
to Django users
I'm trying to write a function to check whether user logged or not. If logged, return user's name,if not, redirect to the login page. I want to write it as a shortcut function like "get_object_or_404". My question is, how to let django return an response to web browser at anywhere I like, not just at the end of a function in views.py.
Reply all
Reply to author
Forward
0 new messages