Tuesday, November 15, 2011

Re: Automatically direct unauthenticated users to homepage

Ivo,

Thank you. I was not using the @login_required decorator. I was using
generic classes like FormView and TemplateView but I see that in order
use login_required I have to put it in the url.py file and edit the
settings.LOGIN_URL to point to my login page.


On Nov 15, 11:25 am, Ivo Brodien <i...@brodien.de> wrote:
> Hi,
>
> these views are protected by @login_required view, right?
>
> If so, users that are not logged in should be redirected to the login view.
>
> If you are not using the decorator, how are you handling users that are not logged in these different views? You are probably doing something against the DRY principle.
>
> bye
> Ivo
>
> On Nov 15, 2011, at 17:16 , CrabbyPete 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+unsubscribe@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.
>
>
>
>  smime.p7s
> 5KViewDownload

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate