Django 提供了非关键字的url map方式
http://www.djangoproject.com/documentation/url_dispatch
from django.conf.urls.defaults import *
urlpatterns = patterns('',
(r'^articles/2003/$', 'news.views.special_case_2003'),
(r'^articles/(\d{4})/$', 'news.views.year_archive'),
(r'^articles/(\d{4})/(\d{2})/$', 'news.views.month_archive'),
(r'^articles/(\d{4})/(\d{2})/(\d+)/$', 'news.views.article_detail'),
)
由于没有关键字,因此所获得的参数是按顺序调用
类似:news.views.month_archive(request, '2005', '03')
个人所好不同吧。总之django一直在努力!
0 Comments:
发表评论
<< Home