Hi Cal,

Basically, i had to show some links by the side of the page(not the "MAIN"
content) and was wondering whether there was some consistent and elegant way
of doing this. I could change the styling of the sidebar and this could
potentially break in some pages and it was a pain to make the edits in all
pages.

I used a variant of your solution : i put the sidebar html in a separate
file(say sidebar.html) , and included it from each of the pages, passing the
active tab. Check for the tab in sidebar.html and suitably render the links
or content based on this.

Thanks.

-V

On Mon, Jun 27, 2011 at 5:24 PM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Can I just clarify what you mean by sidebar?
>
> I assume you are talking about a html element with some options inside it,
> to allow you to navigate through the site?
>
> This is (personally) how I'd do it, although others may prefer a different
> style (you could probably go as far to make this whole thing "classy").
>
> (hand typed code, may need re-writing)
>
> --- views.py ---
> page = "dashboard/help/users"
>
> RequestContext(request, {
>     'section' : page.split("/")
> }
>
> --- layout.html ---
> {% if section.0 = 'dashboard' %}
>     display stuff relating to dashboard only
>     {% if section.1 = 'help' %}
>         display stuff relating to dashboard/help only
>     {% endif %}
> {% endif %}
>
> On Mon, Jun 27, 2011 at 6:27 AM, Venkatraman S <venka...@gmail.com> wrote:
>
>> Hi,
>>
>> I was looking for possible suggestions in implementing sidebars - i have a
>> truck load of screens and need the sidebar to change dynamically base don
>> the view. Most of the siderbar-conten is just links.
>>
>> I was thiking of including the various sidebar options in the base.html
>> and then include a flag to check whether it has to be rendered or not; and
>> in the view pass the relevant flag.
>>
>> Any other ideas?
>>
>> -venkat
>>
>> --
>> 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 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 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.

Reply via email to