Hi.
If I understand your problem correctly, you are looking for a way to
capture different optional parameters from the url, to use them in
further url construction.
Why not use /country/de/district/hf/observation/add/ with entries in
urlconf like:
urlpatterns += patterns('some.app.views',
    url(r'^observation/(?P<action>\[a-z]+)/$', 'observations', name =
'observations_at_large'),
    url(r'^country/(?P<country>[a-z]+)/observation/(?P<action>\[a-z]+)/
$', 'observations', name = 'observations_by_country'),
    url(r'^country/(?P<country>[a-z]+)/district/(?P<district>[a-z]+)/
observation/(?P<action>\[a-z]+)/$', 'observations', name =
'observations_by_district'),
)
and so on.
Then in your view just check which parameters were assigned via
urlconf and pass them to the template to use in url construction.

/{% if country %}country/{{ country }}/{% if district %}district/
{{ district }}/{% endif %}{% endif %}observers/ranking

Hope it helps.
Cheers.

On 25 Sie, 23:40, Uwe Schuerkamp <uwe.schuerk...@gmail.com> wrote:
> Hi folks,
>
> this posting sort of refers to my previous problem from last week as
> I'm still working on the birdwatcher's site. I cannot wrap my head
> around how to create intelligent navigation links from the current
> context or http request. For instance, if the user enters via the url
>
> /de/observers/ranking
>
> for a germany wide ranking display or even
>
> /de/hf/observers/ranking
>
> I need to find an elegant way to render the navigation links to the
> other site functions like "ranking by location"," add a new
> observation" and so on which should look like this, depending on the
> URL above:
>
> /de/observations/add
>
> to add an observation that will limit the list of locations to those
> in "de"  or maybe
>
> /de/hf/observations/add
>
> to add an observation for the hf district.
>
> I've played around with including
> django.core.context_processors.request in my processors list which
> results in the request.path variable being available, but I somehow
> refuse to believe that this problem hasn't been solved before in some
> clever, django-ish way.
>
> Thanks much in advance for any help or input,
>
> Uwe

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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