1 from django.conf.urls.defaults import *
2 from django.views.generic.base import TemplateView
3 from django.views.generic.dates import ArchiveIndexView, DateDetailView
4 from models import Entry, Tag
5
6 entry_dict = {
7 'queryset': Entry.objects.filter(is_draft=False),
8 'date_field': 'published_on',
9 }
10
11 tag_dict = {
12 'queryset': Tag.objects.all(),
13 }
14
15 urlpatterns = patterns('django.views.generic',
16 url(r'^/?$',
17 ArchiveIndexView.as_view(**entry_dict),
18 name="news-main"),
19 url(r'^(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/(?P<slug>[0-9A-Za-z-]+)/$',
20 DateDetailView.as_view(slug_field='slug', month_format='%m', **entry_dict),
21 name="news-detail"),
22 url(r'^about/$',
23 TemplateView.as_view(template_name='news/about.html'), name='news-about'),
24 )
25