Hello there!

I'm seeking some design advice, and I hope you'll have some
suggestions :)

I'm storing my site's menu structure into the database so that I can
edit it from the admin. Here's the code:

class MenuItem(models.Model):
    caption = models.CharField(max_length=30)
    url = models.CharField(max_length=200, blank=True)

Then, in the template which displays the menu I can do something like
this:

<ul>
        {% for item in item_list %}
                <li><a href="{{ item.url }}">{{ item.caption }}</a></li>
        {% endfor %}
</ul>

It works fine, but now I would like to extend it to allow the
insertion of named urls. The problem is that named urls can have
parameters. For example, let's consider the following link:

<li><a href="{% url view_profile user.username %}">My profile</a></li>

How I could do to be able to manage named urls with their parameters,
so that I can edit them from the admin? Should I modify the MenuItem
and how?

Thank you very much!!

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