| /trunk/urls/entries.py r40 | /trunk/urls/entries.py r44 | ||
| 1 | """ | 1 | """ |
|---|---|---|---|
| 2 | URLs for entries in a weblog. | 2 | URLs for entries in a weblog. |
| 3 | 3 | ||
| 4 | """ | 4 | """ |
| 5 | 5 | ||
| 6 | from django.conf.urls.defaults import * | 6 | from django.conf.urls.defaults import * |
| 7 | from django.views.generic import date_based | 7 | from django.views.generic import date_based |
| 8 | 8 | ||
| 9 | from coltrane.models import Entry | 9 | from coltrane.models import Entry |
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | entry_info_dict = { | 12 | entry_info_dict = { |
| 13 | 'queryset': Entry.live.all(), | 13 | 'queryset': Entry.live.all(), |
| 14 | 'date_field': 'pub_date', | 14 | 'date_field': 'pub_date', |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | urlpatterns = patterns('', | 18 | urlpatterns = patterns('', |
| 19 | url(r'^$', | 19 | url(r'^$', |
| 20 | date_based.archive_index, | 20 | date_based.archive_index, |
| 21 | entry_info_dict, | 21 | entry_info_dict, |
| 22 | name='coltrane_entry_archive_index'), | 22 | name='coltrane_entry_archive_index'), |
| 23 | url(r'^(?P<year>\d{4})/$', | 23 | url(r'^(?P<year>\d{4})/$', |
| 24 | date_based.archive_year, | 24 | date_based.archive_year, |
| 25 | entry_info_dict, | 25 | entry_info_dict, |
| 26 | name='coltrane_entry_archive_year'), | 26 | name='coltrane_entry_archive_year'), |
| 27 | url(r'^(?P<year>\d{4})/(?P<month>\w{3})/$', | 27 | url(r'^(?P<year>\d{4})/(?P<month>\w{3})/$', |
| 28 | date_based.archive_month, | 28 | date_based.archive_month, |
| 29 | entry_info_dict, | 29 | entry_info_dict, |
| 30 | name='coltrane_entry_archive_month'), | 30 | name='coltrane_entry_archive_month'), |
| 31 | url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$', | 31 | url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$', |
| 32 | date_based.archive_day, | 32 | date_based.archive_day, |
| 33 | entry_info_dict, | 33 | entry_info_dict, |
| 34 | name='coltrane.entry_archive_day'), | 34 | name='coltrane_entry_archive_day'), |
| 35 | url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$', | 35 | url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$', |
| 36 | date_based.object_detail, | 36 | date_based.object_detail, |
| 37 | dict(entry_info_dict, slug_field='slug'), | 37 | dict(entry_info_dict, slug_field='slug'), |
| 38 | name='coltrane_entry_detail'), | 38 | name='coltrane_entry_detail'), |
| 39 | ) | 39 | ) |