Re: Creating menu from self-nested list

2009-04-17 Thread Ricardob

No help?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Creating menu from self-nested list

2009-04-16 Thread skydark

I have an app in which the objects can relate to themselves and I
wrote a view function that returns a nested list in a similar
structure as the one accepted by the unordered_list built-in template
tag.
[['cat1', ['sub1',sub2]], ['cat2', ['sub3', ['sub4,[sub5]]] ]]

I want more than just a simple unordered_list as a menu since it can
have many levels and would occupy to much space.

As far as I know, other than the unordered_list tag, there is no
simple way of translating the information on the list to a decent
menu, so I think I have to create a function to help unpack. And this
is where I'm having trouble:
-->In a function how can I iterate over this self-nested list, if I
don't know if I'm getting a string or another list. Is there a way to
know if the value represents a string?Or a list?

-->should I create a custom filter tag to do this or should I have my
view output the information on a different structure that would be
easier to read using the control flow tags of the templates?

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---