Hi folks,

please excuse this long-winded post, but I'm a bit stuck with the
layout of my urls.py. Let me try to explain what the site I'm using
Django for does at the moment: Basically it's a website where local
birdwatchers (the ones with feathers, not boobies ;-) can log their
observations. By "local", I mean the local district of Herford.

Noiw after several months of the site being live, I keep getting
requests from users to widen the site's scope to all of Germany or
even world-wide, which I think is a rather nice idea. So right now the
entire site lives under a common URL called "ranking", so I thought I
could restrict and calculate local and nationwide rankings using the
following URL structure:

ranking/de/hf   Country: Germany, District: Herford (I'll be using
german number plates here to discriminate among districts
/ranking/de/_ALL     Nation-Wide Ranking for Germany
/ranking/gr/agn    Agios Nikolaos, Greece: Ranking of observers in
Agios Nik. on Crete, Greece
/ranking/_ALL/_ALL  world-wide ranking

I hope you get the idea.

Ideally, I'd use the url structure to restrict the list of birds,
observations, observers and region by whatever the user provides in
the request.

I've read about mappings that you can use to pass parameters into
functions in urls.py (for instance, {"region": "_ALL"} if only a
country code is provided in the URL), but of course that means I have
to check those parameters in each and every view I write, filter()ing
and excluding within the view as I retrieve the applicable objects
from the database, which seems rather cumbersome and probably breaks
the DRY principle in a big way.

So here's my question as a relative Django noob: Is this the best way
to go about such a layout, or am I missing some critical feature
Django provides already and that I just don't know about yet? I've
read the Definite Guide to Django Book front to back FWIW.

All the best & thanks in advance for your comments & ideas,

Uwe

PS: The site in question is available at http://www.birders-hf.de/ranking/
just in case you want to check it out.

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