Is request.path[1] what you want?

You might also consider basing your menu context on the current view  
rather than the current URL. I typically define a view decorator that  
can attach any context information I need to the current request:

def page_context(section):
     def decorator(func):
         def page_context_wrapper(request, *args, **kwargs):
             request.section = section
             return func(request, *args, **kwargs)
         return page_context_wrapper
     return decorator

Although I usually have several context arguments and bundle them up  
into an object which gets assigned to request.page_context. This  
approach keeps the views url-agnostic.


[1] 
http://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpRequest.path


On Sep 29, 2009, at 1:24 PM, Maksymus007 wrote:

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


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