Rewrite to Django from scratch. Now it's much more user-friendly.
[cookbook.git] / cookbook / urls.py
diff --git a/cookbook/urls.py b/cookbook/urls.py
new file mode 100644 (file)
index 0000000..146dbcc
--- /dev/null
@@ -0,0 +1,36 @@
+from django.conf import settings
+from django.conf.urls.defaults import patterns, include, url
+from django.views.generic import DetailView, ListView
+import taggit.models
+
+import models
+
+# Uncomment the next two lines to enable the admin:
+from django.contrib import admin
+admin.autodiscover()
+
+urlpatterns = patterns('',
+    url(r'^$', ListView.as_view(
+            queryset=models.Recipe.objects.all().order_by('name'),
+            context_object_name='recipes',
+            template_name='cookbook/recipes.html'),
+        name='recipes'),
+     url(r'^recipe/(?P<pk>\d+)/$', DetailView.as_view(
+            model=models.Recipe, template_name='cookbook/recipe.html'),
+        name='recipe'),
+     url(r'^tags/$', ListView.as_view(
+            queryset=taggit.models.Tag.objects.all(),
+            context_object_name='tags',
+            template_name='cookbook/tags.html'),
+        name='tags'),
+     url(r'^tag/(?P<pk>\d+)/$', 'cookbook.views.tag', name='tag'),
+
+    # Uncomment the admin/doc line below to enable admin documentation:
+    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
+
+    # Uncomment the next line to enable the admin:
+    url(r'^admin/', include(admin.site.urls), name='admin'),
+
+    url(r'^favicon\.ico$', 'django.views.generic.simple.redirect_to',
+        kwargs={'url': settings.STATIC_URL + 'cookbook.ico'}),
+)