> I'd like to build one component "Login" or "Navigation" which can be
> places on different templates at different palces. e.g.i'd like to
> have the the login component on the right side by default, but
> sometimes it should be in the content area.
>
> Till now i learend that i can repalce {% block login %} by extending
> one base template and overriding the block.
> But what i'd like to do is having one componend "login" and place that
> component e.g. inside the login-block on the base page.
>
> I'd like to do this because i want to build up some logic inside that
> components and don't like to have that logic on the main template but
> in one seperate "file".
>
> Till now i'd do it like this:
>
> base.html: Define the blocks
> -> base_login_right.html: Template havin login on the right side
> (override only the login block)
> -> base_login_right_navigation.html: Template having the login on the
> right side and also havin the navigation. (override only the
> navigation block)
>
> All my pages would extend base_login_right_navigation.html then.
>
> Somehow this seems very strange to me. Having the login on the left
> side would force me to define one new base.html, base_login_left.html
> and also base_login_left_navigation.html including all the code once
> againe ...
>
> I am prety sure i missed something :)
>
> Any hints would be very welcome ... ( block.super probably? )

You should consider creating template tags for these "widgets". So,
you would have a navigation tag, a login tag, etc. The tags are
implemented using Python code and HTML so you have more control on
what they do.

If you want to style these widgets based on their location in your
layout, simply wrap them in a CSS class container like this:

<div class="side-panel-widget">
{% login_tag %}
</div>

<div class="main-panel-widget">
{% login_tag %}
</div>

-Rajesh D
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to