Working on making some URLs on a project of mine ReSTful, and decided
to go with the filename extensions route for specifying content-type.

I've got a view named concerts, and to keep backwards compatibility, I
need to make sure the old URLs still work.  I need the urlpattern to
match...

^/concerts
^/concerts/
^/concerts.html
^/concerts/123
^/concerts/123/
^/concerts/123.html

The regex I wrote up to do this is...

^/concerts(?:/(?P<id>\d+))?(?:/|\.(?P<format>\w{4}))?$

Which matches everything perfectly when going forward, but any attempt
to use reverse fails with a NoReverseMatch exception, any ideas on an
alternate regex or the correct way to reverse this?

The reverse call I'm using is...

reverse('concerts', kwargs={'id': concert.id, 'format': format})

Thanks!

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