From deb2f6420e4f44f6d5d731abbd3340c258a0cc52 Mon Sep 17 00:00:00 2001 From: Mike Crute Date: Wed, 29 Dec 2010 17:47:42 -0500 Subject: Adding recipe list --- greenbox/recipe/urls.py | 6 ++++++ greenbox/recipe/views.py | 7 ++++++- greenbox/templates/recipe/recipe_list.html | 5 +++++ greenbox/urls.py | 18 ++++-------------- 4 files changed, 21 insertions(+), 15 deletions(-) create mode 100644 greenbox/recipe/urls.py create mode 100644 greenbox/templates/recipe/recipe_list.html diff --git a/greenbox/recipe/urls.py b/greenbox/recipe/urls.py new file mode 100644 index 0000000..d344e0a --- /dev/null +++ b/greenbox/recipe/urls.py @@ -0,0 +1,6 @@ +from django.conf.urls.defaults import patterns, url + + +urlpatterns = patterns('recipe.views', + url(r'^$', 'recipe_list'), +) diff --git a/greenbox/recipe/views.py b/greenbox/recipe/views.py index 60f00ef..d1872c5 100644 --- a/greenbox/recipe/views.py +++ b/greenbox/recipe/views.py @@ -1 +1,6 @@ -# Create your views here. +from models import Recipe +from django.views.generic.list_detail import object_list + + +def recipe_list(request): + return object_list(request, queryset=Recipe.objects.all()) diff --git a/greenbox/templates/recipe/recipe_list.html b/greenbox/templates/recipe/recipe_list.html new file mode 100644 index 0000000..3ceae72 --- /dev/null +++ b/greenbox/templates/recipe/recipe_list.html @@ -0,0 +1,5 @@ + diff --git a/greenbox/urls.py b/greenbox/urls.py index 9202bff..7ee6f28 100644 --- a/greenbox/urls.py +++ b/greenbox/urls.py @@ -1,17 +1,7 @@ -from django.conf.urls.defaults import * - -# Uncomment the next two lines to enable the admin: -from django.contrib import admin -admin.autodiscover() +from django.conf.urls.defaults import patterns, include, url +from django.contrib import admin; admin.autodiscover() urlpatterns = patterns('', - # Example: - # (r'^greenbox/', include('greenbox.foo.urls')), - - # Uncomment the admin/doc line below and add 'django.contrib.admindocs' - # to INSTALLED_APPS to enable admin documentation: - # (r'^admin/doc/', include('django.contrib.admindocs.urls')), - - # Uncomment the next line to enable the admin: - (r'^admin/', include(admin.site.urls)), + url(r'^$', include('recipe.urls')), + url(r'^admin/', include(admin.site.urls)), ) -- cgit v1.2.3