from django.conf import settings from django.conf.urls.defaults import * from newsroom.models import * from newsroom import views as nr_views from newsroom.feeds import LatestNewsFeed # custom views stories urlpatterns = patterns('newsroom.views', url(r'^feed.xml', LatestNewsFeed(), name="nr-news-feed"), url(r'^authors/$', view=nr_views.author_list, name="nr-author-list"), url(r'^authors/(?P[\-\d\w]+)/(?P[\-\d\w]+)/$', view=nr_views.author_detail, name="nr-author-detail"), url(r'^archives/$', view=nr_views.archive_index, name='nr-archive-index'), url(r'^archives/(?P\d{4})/$', view=nr_views.archive_year, name='nr-archive-year'), url(r'^archives/(?P\d{4})/(?P[\-\d\w]+)/$', view=nr_views.archive_detail, name='nr-archive-section-detail'), url(r'^$', view=nr_views.paper_index, name="nr-index"), # We use a custom view so we can increment the view_count url(r'^editorials/(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/(?P[\-\d\w]+)/$', view=nr_views.editorial_detail, name='nr-editorial-detail'), url(r'(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/(?P[\-\d\w]+)/$', view=nr_views.story_detail, name='nr-story-detail'), url(r'^tags/$', view=nr_views.tag_index, name='nr-tag-index'), url(r'^tags/(?P[\-\d\w]+)/$', view=nr_views.tag_detail, name='nr-tag-detail'), ) # editorials editorial_args = {'date_field': 'published_on', 'queryset': Editorial.objects.published()} urlpatterns += patterns('django.views.generic.date_based', url(r'^editorials/(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/$', 'archive_day', editorial_args, name='nr-editorial-archive-day'), url(r'^editorials/(?P\d{4})/(?P[a-z]{3})/$', 'archive_month', editorial_args, name='nr-editorial-archive-month'), url(r'^editorials/(?P\d{4})/$', 'archive_year', editorial_args, name='nr-editorial-archive-year'), ) # stories story_args = {'date_field': 'published_on', 'queryset': Story.objects.published()} urlpatterns += patterns('django.views.generic.date_based', #url(r'(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/(?P[\-\d\w]+)/$', 'object_detail', story_args, name='nr-story-detail'), url(r'(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/$', 'archive_day', story_args, name='nr-story-archive-day'), url(r'(?P\d{4})/(?P[a-z]{3})/$', 'archive_month', story_args, name='nr-story-archive-month'), url(r'(?P\d{4})/$', 'archive_year', story_args, name='nr-story-archive-year'), ) urlpatterns += patterns('django.views.generic.list_detail', url(r'page/(?P[0-9]+)/$', 'object_list', {'queryset': Story.objects.published(), 'allow_empty': True, 'paginate_by': 5}, name='nr-story-list'), )