mtg-web/cards/views.py

12 lines
474 B
Python
Raw Normal View History

2010-08-26 03:43:19 +00:00
# Create your views here.
from django.shortcuts import render_to_response
2010-09-17 21:44:54 +00:00
from mtgweb.analyzer.models import Card
from mtgweb.lib.mtg.mtg import ManaCost
2010-08-26 03:43:19 +00:00
import mtgweb.lib.mtg.database as database
def display(request, name):
2010-09-17 21:44:54 +00:00
card = Card.objects.get(name=name)
cost = ManaCost(str(card.cost))
abilities = [ability for ability in card.text.split("\n") if ability]
return render_to_response('cards/view.html', {'card': card, 'cost': cost, 'abilities': abilities})