mtg-web/decks/views.py

13 lines
432 B
Python
Executable file

from django.http import Http404
from django.shortcuts import render_to_response
from mtgweb.analyzer.models import Deck
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})