diff options
author | Mike Crute <mcrute@gmail.com> | 2010-12-29 17:47:42 -0500 |
---|---|---|
committer | Mike Crute <mcrute@gmail.com> | 2010-12-29 17:47:42 -0500 |
commit | deb2f6420e4f44f6d5d731abbd3340c258a0cc52 (patch) | |
tree | 945248ee96152b9396c4ca7abbf8836c725c1066 | |
parent | da8c20c181eb7aac8755c617c9425896ce8cb827 (diff) | |
download | greenbox-deb2f6420e4f44f6d5d731abbd3340c258a0cc52.tar.bz2 greenbox-deb2f6420e4f44f6d5d731abbd3340c258a0cc52.tar.xz greenbox-deb2f6420e4f44f6d5d731abbd3340c258a0cc52.zip |
Adding recipe list
-rw-r--r-- | greenbox/recipe/urls.py | 6 | ||||
-rw-r--r-- | greenbox/recipe/views.py | 7 | ||||
-rw-r--r-- | greenbox/templates/recipe/recipe_list.html | 5 | ||||
-rw-r--r-- | greenbox/urls.py | 18 |
4 files changed, 21 insertions, 15 deletions
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 @@ | |||
1 | from django.conf.urls.defaults import patterns, url | ||
2 | |||
3 | |||
4 | urlpatterns = patterns('recipe.views', | ||
5 | url(r'^$', 'recipe_list'), | ||
6 | ) | ||
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 @@ | |||
1 | # Create your views here. | 1 | from models import Recipe |
2 | from django.views.generic.list_detail import object_list | ||
3 | |||
4 | |||
5 | def recipe_list(request): | ||
6 | 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 @@ | |||
1 | <ul> | ||
2 | {% for recipe in object_list %} | ||
3 | <li>{{ recipe.title }}</li> | ||
4 | {% endfor %} | ||
5 | </ul> | ||
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 @@ | |||
1 | from django.conf.urls.defaults import * | 1 | from django.conf.urls.defaults import patterns, include, url |
2 | 2 | from django.contrib import admin; admin.autodiscover() | |
3 | # Uncomment the next two lines to enable the admin: | ||
4 | from django.contrib import admin | ||
5 | admin.autodiscover() | ||
6 | 3 | ||
7 | urlpatterns = patterns('', | 4 | urlpatterns = patterns('', |
8 | # Example: | 5 | url(r'^$', include('recipe.urls')), |
9 | # (r'^greenbox/', include('greenbox.foo.urls')), | 6 | url(r'^admin/', include(admin.site.urls)), |
10 | |||
11 | # Uncomment the admin/doc line below and add 'django.contrib.admindocs' | ||
12 | # to INSTALLED_APPS to enable admin documentation: | ||
13 | # (r'^admin/doc/', include('django.contrib.admindocs.urls')), | ||
14 | |||
15 | # Uncomment the next line to enable the admin: | ||
16 | (r'^admin/', include(admin.site.urls)), | ||
17 | ) | 7 | ) |