Skip to content

Instantly share code, notes, and snippets.

@benmcnelly
Created March 26, 2011 02:29
Show Gist options
  • Save benmcnelly/887972 to your computer and use it in GitHub Desktop.
Save benmcnelly/887972 to your computer and use it in GitHub Desktop.
menu/views.py
# Create your views here.
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.views.generic.list_detail import object_detail, object_list
from djangorestaurant.menu.models import *
def item_list(request, page=0, paginate_by=6, template_name='menu/list.html'):
items = Item.objects.all()
return render_to_response(template_name, {"items":items})
def item_detail(request, item_id, template_name='menu/detail.html'):
item = Item.objects.get(id=item_id)
return render_to_response(template_name, {"item":item})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment