Source

Django-Portfolio / demenza_site / urls.py

Full commit
from django.conf.urls.defaults import patterns, include, url
from django.views.generic.simple import direct_to_template

from django.views.generic import list_detail

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

from blog.models import Blog

blog_info = {
    "queryset": Blog.objects.filter(active=True),
}

urlpatterns = patterns('',

    url(r'^admin/', include(admin.site.urls)),

    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    (r'^$', direct_to_template, {
        'template': 'pages/index.html'
    }),

    (r'^about/$', direct_to_template, {
        'template': 'pages/about.html'
    }),

    #url(r'^$', list_detail.object_list, blog_info, name="home"),
    #url(r'^blog/(?P<slug>[-\w]+)/$', 'blog.views.blog', name="blog"),
    #url(r'^blog/(?P<slug>[-\w]+)/(?P<y>\d{4})/$', 'blog.views.year', name="year"),
    #url(r'^blog/(?P<slug>[-\w]+)/(?P<y>\d{4})/(?P<m>\d{2})/$', 'blog.views.month', name="month"),
    #url(r'^blog/(?P<blog>[-\w]+)/post/(?P<slug>[-\w]+)/$', 'blog.views.post', name="post"),

    url(r'^$', list_detail.object_list, blog_info, name="home"),
    url(r'^(?P<slug>[-\w]+)/$', 'blog.views.blog', name="blog"),
    url(r'^(?P<slug>[-\w]+)/(?P<y>\d{4})/$', 'blog.views.year', name="year"),
    url(r'^(?P<slug>[-\w]+)/(?P<y>\d{4})/(?P<m>\d{2})/$', 'blog.views.month', name="month"),
    url(r'^(?P<blog>[-\w]+)/post/(?P<slug>[-\w]+)/$', 'blog.views.post', name="post"),

    (r'^polls/$', 'polls.views.index'),
    (r'^polls/(?P<poll_id>\d+)/$', 'polls.views.detail'),
    (r'^polls/(?P<poll_id>\d+)/results/$', 'polls.views.results'),
    (r'^polls/(?P<poll_id>\d+)/vote/$', 'polls.views.vote'),

    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls)),
)