1. Vladimir Mihailenco
  2. loutontheweb.co.cc

Source

loutontheweb.co.cc / mcblog / urls / entries.py

from django.conf.urls.defaults import *

from mcblog.models import Entry
from mcblog.feeds import LatestEntriesFeed


entry_info = {'queryset': Entry.objects.select_related().all()}
entry_date_based_info = dict(entry_info, date_field='pub_date')

urlpatterns = patterns('',
    url(r'^$',
        'django.views.generic.list_detail.object_list',
        dict(entry_info, paginate_by=10),
        name='mcblog-entry-list'),
    url(r'^post-links/$',
        'mcblog.views.post_links',
        name='mcblog-post-links'),
)

urlpatterns += patterns('django.views.generic.date_based',
    url(r'^archive/$',
        'archive_index',
        entry_date_based_info,
        name='mcblog-entry-archive-index'),
    url(r'^(?P<year>\d{4})/$',
        'archive_year',
        dict(entry_date_based_info, make_object_list=True),
        name='mcblog-entry-archive-year'),
    url(r'^(?P<year>\d{4})/(?P<month>\w{3})/$', 'archive_month',
        entry_date_based_info,
        name='mcblog-entry-archive-month'),
    url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$',
        'archive_day',
        entry_date_based_info,
        name='mcblog-entry-archive-day'),
    url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$',
        'object_detail',
        entry_date_based_info,
        name='mcblog-entry-detail'),
    url(r'^latest/feed/$',
        LatestEntriesFeed(),
        name='mcblog-entry-feed'),
)