Monday, November 29, 2010

Re: If logged in show X, if not Y

I there any way to name a template? For example my subtempaltes/
loginform.html - I want to name it loginform.
In group work it'll be a very useful feature. I knto that {% include
%} tag allows passing name - but how?

On 29 Lis, 04:09, Venkatraman S <venka...@gmail.com> wrote:
> On Mon, Nov 29, 2010 at 7:44 AM, Andre Terra <andrete...@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