mtg-web/decks/views.py

14 lines
432 B
Python
Raw Normal View History

from django.http import Http404
2010-08-26 03:43:19 +00:00
from django.shortcuts import render_to_response
from mtgweb.analyzer.models import Deck
2010-08-26 03:43:19 +00:00
def index(request):
decks = Deck.objects.all()
return render_to_response('decks/index.html', {'decks': decks})
def detail(request, id):
try:
deck = Deck.objects.get(pk=id)
except Deck.DoesNotExist:
raise Http404
return render_to_response('decks/detail.html', {'deck': deck})