-
+ {% for ability in card.text %}
+
- {{ ability }} + {% endfor %} +
diff --git a/cards/__init__.py b/cards/__init__.py new file mode 100755 index 0000000..e69de29 diff --git a/cards/models.py b/cards/models.py new file mode 100755 index 0000000..71a8362 --- /dev/null +++ b/cards/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/cards/tests.py b/cards/tests.py new file mode 100755 index 0000000..2247054 --- /dev/null +++ b/cards/tests.py @@ -0,0 +1,23 @@ +""" +This file demonstrates two different styles of tests (one doctest and one +unittest). These will both pass when you run "manage.py test". + +Replace these with more appropriate tests for your application. +""" + +from django.test import TestCase + +class SimpleTest(TestCase): + def test_basic_addition(self): + """ + Tests that 1 + 1 always equals 2. + """ + self.failUnlessEqual(1 + 1, 2) + +__test__ = {"doctest": """ +Another way to test that 1 + 1 is equal to 2. + +>>> 1 + 1 == 2 +True +"""} + diff --git a/cards/views.py b/cards/views.py new file mode 100755 index 0000000..0ea2027 --- /dev/null +++ b/cards/views.py @@ -0,0 +1,8 @@ +# Create your views here. +from django.shortcuts import render_to_response +import mtgweb.lib.mtg.database as database + +def display(request, name): + db = database.TextDB('/home/correlr/code/mtgweb/lib/mtg/db.txt') + card = db.getCard(name.replace('_', ' ').strip()) + return render_to_response('cards/view.html', {'card': card}) diff --git a/decks/views.py b/decks/views.py index 60f00ef..b22fe02 100755 --- a/decks/views.py +++ b/decks/views.py @@ -1 +1,10 @@ -# Create your views here. +from django.shortcuts import render_to_response +import mtgweb.lib.mtg.mtg as mtg +import mtgweb.lib.mtg.database as database + +def index(request): + db = database.TextDB('mtgweb/lib/mtg/db.txt') + deck = mtg.Deck() + print db.getCard('Forest') + deck.load('mtgweb/lib/mtg/decks/WhiteBeast.txt', db) + return render_to_response('decks/index.html', {'deck': deck}) diff --git a/settings.py b/settings.py index 032d337..4aa4bde 100755 --- a/settings.py +++ b/settings.py @@ -11,8 +11,8 @@ MANAGERS = ADMINS DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': '', # Or path to database file if using sqlite3. + 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. + 'NAME': 'mtg.db', # Or path to database file if using sqlite3. 'USER': '', # Not used with sqlite3. 'PASSWORD': '', # Not used with sqlite3. 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. @@ -81,6 +81,7 @@ TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. + '/home/correlr/code/mtgweb/templates', ) INSTALLED_APPS = ( diff --git a/templates/cards/view.html b/templates/cards/view.html new file mode 100755 index 0000000..1456bb1 --- /dev/null +++ b/templates/cards/view.html @@ -0,0 +1,80 @@ + +
+foobar ++ + diff --git a/urls.py b/urls.py index f96352d..7622031 100755 --- a/urls.py +++ b/urls.py @@ -7,6 +7,8 @@ from django.conf.urls.defaults import * urlpatterns = patterns('', # Example: # (r'^mtgweb/', include('mtgweb.foo.urls')), + (r'^cards/(?P