django - How to check if user is authenticated for entire url include -


i have following url statement in urls.py

url(r'^search/', include('haystack.urls')), 

now want users access url if authenticated, otherwise request should redirected url '/accounts/login/'

i know need use logic this, not sure how done urls included other packages?

if request.user.is_authenticated():     # authenticated users. else:     # anonymous users. 


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -