I did something like this recently on a project.
The way I approached it was to come up with a dataset that represented
the menu at the template level with the various bits I needed to know
in order to open another level, etc. Something like this:
menu = [
{'title': title, 'url': url, 'active': active, 'level': level},
...
}
In the view you'd query the database using the db api and gather the
data however you need to then build that data structure. Once built,
add the data structure to the template context so it's available to the
template. The template then uses the template API to iterate over the
menu list and output the menu.
I'm leaving out a lot of the details but that's a good summary, I think.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---