I think the problem is your regular expression:

^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>\w+)/$

This says
- four digits for a year (2010 - ok)
- slash
- three letters from a-z for month (jul - ok)
- slash
- one or two letters for day (11 - not ok, this should be \d{1,2})
- slash
- slug, made up of one or more letters (1ste-blog-post - not ok, there are
hypens and numbers.  this should be [-\d\w]+
- slash

So, try this:

^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\d{1,2})/(?P<slug>[-\d\w]+)/$

Hope that helps,

Tim.

> Hi,
>
> i have a strange problem with urls.
>
> Project name:  erp
> Application name: blog (and some more)
>
> problem occurs with certain view of blog-application
>
> This URL works fine:
> http://erp/blog/
>
> When I use the URL below, I get an 404-error.
> http://erp/blog/2010/jul/11/1ste-blog-post/
>
> -----------------8<----------------------------
> Page not found (404)
> Request Method:         GET
> Request URL:    http://erp/blog/2010/jul/11/1ste-blog-post/
>
> Using the URLconf defined in erp.urls, Django tried these URL patterns,
> in this order:
>
>     1. ^admin/
>     2. ^blog/ ^$
>     3. ^blog/
> ^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>\w+)/$
>     4. ^blog/ ^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$
>     5. ^blog/ ^(?P<year>\d{4})/(?P<month>[a-z]{3})/$
>     6. ^blog/ ^(?P<year>\d{4})/$
>     7. ^card/
>     8. ^dashboard/
>     9. ^todo/
>    10. ^comments/
>    11. ^accounts/login/$
>    12. ^accounts/logout/$
>    13. ^accounts/password_change/$
>    14. ^accounts/password_change_done/$
>
> The current URL, blog/2010/jul/11/1ste-blog-post/, didn't match any of
> these.
> -----------------8<----------------------------
>
>
> Project urls.py:
>
> -----------------8<----------------------------
> from django.conf.urls.defaults import include, patterns, url
> from django.contrib import admin
>
> admin.autodiscover()
>
> urlpatterns = patterns('',
>      (r'^admin/', include(admin.site.urls)),
>      (r'^blog/', include('erp.blog.urls')),
>      (r'^card/', include('erp.card.urls')),
>      (r'^dashboard/', include('erp.dashboard.urls')),
>      (r'^todo/', include('erp.todo.urls')),
>      (r'^comments/', include('django.contrib.comments.urls')),
>      (r'^accounts/login/$',
>          'django.contrib.auth.views.login',
>          {'template_name': 'login.html'}
>      ),
>      (r'^accounts/logout/$',
>          'django.contrib.auth.views.logout',
>          {'template_name': 'logout.html'}
>      ),
>      (r'^accounts/password_change/$',
>          'django.contrib.auth.views.password_change',
>          {'template_name': 'password_change_form.html'}
>      ),
>      (r'^accounts/password_change_done/$',
>          'django.contrib.auth.views.password_change_done',
>          {'template_name': 'password_change_done.html'}
>      ),
> )
> -----------------8<----------------------------
>
>
> blog/urls.py:
> -----------------8<----------------------------
> from django.conf.urls.defaults import patterns
> from models import Post
>
> info_dict = {
>      'date_field':       'pub_date',
>      'queryset':         Post.objects.all(),
>      'template_name':   'blog_index.html',
>      'template_object_name':   'posts',
> }
>
> urlpatterns = patterns('django.views.generic.date_based',
>      (r'^$',
>          'archive_index',
>          info_dict
>      ),
>
> (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_post.html')
>      ),
>      (r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$',
>          'archive_day',
>          info_dict
>      ),
>      (r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/$',
>          'archive_month',
>          info_dict
>      ),
>      (r'^(?P<year>\d{4})/$',
>          'archive_year',
>          dict(info_dict, template_name='blog_year.html')
>      ),
> )
> -----------------8<----------------------------
>
>
> What can be wrong?
>
> Regards,
> Stephan
>
> --
> 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.
>
>


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