0

Can anyone see why this wouldn't be working? I'm fairly new to Django so any help would be much appreciated.

Actual URL: http://127.0.0.1:8000/2010/may/12/my-second-blog-post/

urls.py:

(r'(?P<year>d{4})/(?P<month>[a-z]{3})/(?P<day>w{1,2})/(?P<slug>[-w]+)/$', 'object_detail', dict(info_dict, slug_field='slug',template_name='blog/detail.html')),

2 Answers 2

12
r'(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[\w-]+)/$', 
'object_detail', 
dict(info_dict, slug_field='slug',template_name='blog/detail.html')),

You seem to have forgotten the backslashes.

Sign up to request clarification or add additional context in comments.

2 Comments

shouldn't ?P<day>w{1,2} be ?P<day>d{1,2} too?
@stevejalim could be, \w matches digits too though. Not sure what the author wanted.
0

Are you specifying this in an app context or in the project url routing?

You may need to start your regular expression with a ^.

(r'^foo/$', 'foo'),

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.