Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » Django regular expression urls wrong match [RSS Feed]

#1 Jan. 20, 2011 15:54:31

Ali I.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Django regular expression urls wrong match


Here is my urls.py:

urlpatterns = patterns('',

# Admin's

(r'^admin/filebrowser/', include('filebrowser.urls')),

(r'^admin/', include(admin.site.urls)),

(r'^tiny_mce/(?P<path>.*)$', 'django.views.static.serve',

{ 'document_root': os.path.join(settings.MEDIA_ROOT,
> 'tinymce/jscripts/tiny_mce') }),


> # Media

(r'^media/(?P<path>.*)$', 'django.views.static.serve',

{ 'document_root': settings.MEDIA_ROOT }),

)


> urlpatterns += patterns('news.views',

# Categories

(r'^(?P<lang_name>{2})/categories/$', 'category_list',

{}, 'news_category_list'),

(r'^(?P<lang_name>{2})/categories/(?P<slug>+)/$',
> 'category_detail',

{}, 'news_category_detail'),


> # news entries

(r'^(?P<lang_name>{2})/news/$', 'entry_archive',

{}, 'news_entry_archive_index'),

(r'^(?P<lang_name>{2})/(?P<year>\d{4})/$', 'entry_archive_year',

{}, 'news_entry_archive_year'),

(r'^(?P<lang_name>{2})/(?P<year>\d{4})/(?P<month>\w{3})/$',
> 'entry_archive_month',

{}, 'news_entry_archive_month'),


>
> (r'^(?P<lang_name>{2})/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$',
> 'entry_archive_day',

{}, 'news_entry_archive_day'),


>
> (r'^(?P<lang_name>{2})/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>+)/$',
> 'entry_detail',

{}, 'news_entry_detail'),

)


But when I try to accesshttp://127.0.0.1:8000/en/categories/it asks for
entry_archive_day view, matches wrong pattern.

And when I comment out that pattern url matches with entry_archive_month
view pattern. If I try to comment out that one too, it'll match with
entry_archive_year. And then I try to comment out the last one too, it'll
match with entry_archive. After commenting out the latter one, I'll get
expected result: it'll match with category_list view pattern.

I've tried to change places of patterns. I've also tried to separate
categories and entries url pattern lists. No result.

I've tried it on another machine too. Same result.

thanks in advance,
Ali

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » Django regular expression urls wrong match [RSS Feed]

Board footer

Moderator control

Enjoy the 24th of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support