Commits

Alexandre Beaulieu committed 23834c4

Added desires and responsibilities applications. Added form rendering to achievement import template.

  • Participants
  • Parent commits 9c3e076

Comments (0)

Files changed (13)

File achievements/templates/achievements/import.html

 
 {% block content %}
 <h1>Import Achievement List</h1>
+
+<form action="" method="post"> {% csrf_token %}
+ {{ form.as_p }}
+ <input type="submit" value="Submit">
+</form>
+
 {% endblock %}

File desires/__init__.py

Empty file added.

File desires/models.py

+from django.db import models
+from django.contrib.auth.models import User
+
+class Desire(models.Model):
+    """
+        Represents a person's desire.
+    """
+    desc = models.TextField()
+    rank = models.IntegerField(default=1)
+    satisfied = models.BooleanField(default=False)
+    public    = models.BooleanField(default=True)
+    # --
+    owner = models.ForeignKey(User)

File desires/tests.py

+"""
+This file demonstrates writing tests using the unittest module. These will pass
+when you run "manage.py test".
+
+Replace this 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.assertEqual(1 + 1, 2)

File desires/urls.py

+from django.conf.urls.defaults import patterns, include, url
+
+urlpatterns = patterns('',
+    url(r'^$', 'desires.views.list', name='desire list'),
+    url(r'^new/$', 'desires.views.new', name='new desire'),
+    url(r'^delete/(?P<id>\d+)/$', 'desires.views.delete', name='delete desire'),
+    url(r'^satisfy/(?P<id>\d+)/$', 'desires.views.satisfy', name='satisfy desire'),
+    url(r'^user/(?P<username>[a-z]+)/$', 'desires.views.list', name='user desires'),
+)

File desires/views.py

+# Create your views here.
 # -------------------------------
     'HARD.hard', # Controller App
     'HARD.achievements',
+    'HARD.desires',
+    'HARD.tasks', # Responsibilities
 )
 
 # A sample logging configuration. The only tangible logging

File tasks/__init__.py

Empty file added.

File tasks/admin.py

+from django.contrib import admin
+from tasks.models import Task
+
+admin.site.register(Task)

File tasks/models.py

+from django.db import models
+from django.contrib.auth.models import User
+
+class Task(models.Model):
+    """
+        Represents a claimable task.
+    """
+    title = models.CharField(max_length=255)
+    desc  = models.TextField()
+    # --
+    owner = models.ForeignKey(User, blank=True, null=True, default=None)
+    

File tasks/tests.py

+"""
+This file demonstrates writing tests using the unittest module. These will pass
+when you run "manage.py test".
+
+Replace this 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.assertEqual(1 + 1, 2)

File tasks/urls.py

+from django.conf.urls.defaults import patterns, include, url
+
+urlpatterns = patterns('',
+    url(r'^$', 'tasks.views.list', name='task list'),
+    url(r'^claim/(?P<task_id>\d+)/$', 'tasks.views.claim', name='claim task'),
+    url(r'^drop/(?P<task_id>\d+)/$', 'tasks.views.drop', name='drop task'),
+    url(r'^user/(?P<username>[a-z]+)/$', 'tasks.views.list', name='user tasks'),
+    # TODO: Eventually, we'd like form pages to manage the tasks, instead of going
+    # through Django admin.
+)

File tasks/views.py

+# Create your views here.