Thursday, July 26, 2012

Re: newbie URL problem

On Thu, Jul 26, 2012 at 8:32 AM, Karen Tracey <kmtracey@gmail.com> wrote:
On Thu, Jul 26, 2012 at 12:20 AM, Felipe Sitta <musicplant@gmail.com> wrote:

I messed up with the code and figured that the problem is with the urls patterns. Here are the codes:

the url patterns from urls.py
    url(r'^Track List/(?P<countryList_countryName>(.*)\w+)/$','tracks.views.trackList'),
    url(r'^Track List/(?P<countryList_countryName>(.*)\w+)/(?P<track_name>)/$','tracks.views.track'),

Get rid of the (.*) in those url regular expressions.

And when you do that you'll also need to adjust your track names to have no spaces or explicitly allow space in the country/track names, in general it would be better to slugify your names for use in urls, which will get rid of spaces and other characters that will wind up getting percent-encoded. Also the 2nd url pattern seems to be missing the regex pattern part for the track_name part?

Karen
--
http://tracey.org/kmt/

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment