Rewrite to Django from scratch. Now it's much more user-friendly.
[cookbook.git] / cookbook / urls.py
1 from django.conf import settings
2 from django.conf.urls.defaults import patterns, include, url
3 from django.views.generic import DetailView, ListView
4 import taggit.models
5
6 import models
7
8 # Uncomment the next two lines to enable the admin:
9 from django.contrib import admin
10 admin.autodiscover()
11
12 urlpatterns = patterns('',
13     url(r'^$', ListView.as_view(
14             queryset=models.Recipe.objects.all().order_by('name'),
15             context_object_name='recipes',
16             template_name='cookbook/recipes.html'),
17         name='recipes'),
18      url(r'^recipe/(?P<pk>\d+)/$', DetailView.as_view(
19             model=models.Recipe, template_name='cookbook/recipe.html'),
20         name='recipe'),
21      url(r'^tags/$', ListView.as_view(
22             queryset=taggit.models.Tag.objects.all(),
23             context_object_name='tags',
24             template_name='cookbook/tags.html'),
25         name='tags'),
26      url(r'^tag/(?P<pk>\d+)/$', 'cookbook.views.tag', name='tag'),
27
28     # Uncomment the admin/doc line below to enable admin documentation:
29     # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
30
31     # Uncomment the next line to enable the admin:
32     url(r'^admin/', include(admin.site.urls), name='admin'),
33
34     url(r'^favicon\.ico$', 'django.views.generic.simple.redirect_to',
35         kwargs={'url': settings.STATIC_URL + 'cookbook.ico'}),
36 )