Sunday, November 28, 2010

Re: If logged in show X, if not Y


On Mon, Nov 29, 2010 at 7:44 AM, Andre Terra <andreterra@gmail.com> wrote:
I think a more elegant approach would be to have a main template with {% block some_name_for_the_part_that_changes %}, and have two different template (logged_in.html and not_logged_in.html) that both extend said block in 'main.html'.

The conditional logic in View or Template depends on what you want to show/not-show in the template -- if its just a small section that you want to conditionally show, then prefer the auth check in the template, else move it to the view.


-V-
http://twitter.com/venkasub

--
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.

No comments:

Post a Comment