isn't this what block tags are for? or custom template tags?

On Jun 28, 10:48 am, garagefan <monkeygar...@gmail.com> wrote:
> This sounds like too much work, every time you want a new option in
> the sidebar you're adding another if, right?
>
> I'm planning on building a template tag to handle side content like
> that. I am using mezzanine as my base so i have the luxury of having
> every url resolve to their Page model. So i'm going to be using a
> onetomany field (i think) to assign content to pages as well as a
> section (sidebar_left , sidebar_right, etc)
>
> In the main template all i'm going to have to do is
>
> {% sidebar_left page.id %}
>
> pass page.id through to the function and return all of the content
> that has a key to that page.id.
>
> there will be more to it, such as figuring out which model the content
> belongs to in order to send the data to the correct template to render
> it with
>
> On Jun 27, 7:54 am, "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.

Reply via email to