On Tue, Nov 15, 2011 at 8:25 AM, CrabbyPete <pete.do...@gmail.com> wrote: > I have a site with lots of views. When someone comes to my site and is > not logged in I direct them to the homepage to login. However a user > could type in a whole url for a view and it will go there and cause an > error because the view expects the user to be logged in. I could put > logic in every view to see if the user is logged in but it seems > redundant. Is there a way to force anonymous users to the home even if > they type in a full url to a specific view > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > >
You can use middleware to redirect all unauthenticated users to your login page, something like this: http://stackoverflow.com/questions/3214589/django-how-can-i-apply-the-login-required-decorator-to-my-entire-site-excludi Colin -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.