Maksymus007 wrote:
> I'm looking for simple way of managing menu - so my question is - how
> i can get currently used URL?
> 

I'm presently using a very simple template-based menu scheme, as each
view tends to use a separate template. I don't need to worry about the
url. Hardly the be-all and end-all, but very simple.

If I have a base.html.djt template with my menubar in it with a block
for each menuitem, then you can use a variable to mark a particular item
current in a child template.  I guess this might be brittle if scoping
rules ever change, but works fine in 1.1:

base.html.djt:

{% block menubar %}

{% block menubar_blah %}
  <div class="menubar_item {% if current %}menubar_item_current{% endif %}">
    <a href="{% url some.view %}">Blah</a>
  </div>
</div>
{% endblock %}

...

{% endblock %}

child.html.djt:

{% extends "base.html.djt" %}
{% block menubar_blah %}
{% with 1 as current %}
{{ block.super }}
{% endwith %}
{% endblock %}



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