aboutsummaryrefslogtreecommitdiffstats
path: root/apps/issues
diff options
context:
space:
mode:
Diffstat (limited to 'apps/issues')
-rw-r--r--apps/issues/__init__.py0
-rw-r--r--apps/issues/forms.py7
-rw-r--r--apps/issues/models.py33
-rw-r--r--apps/issues/tests.py16
-rw-r--r--apps/issues/views.py18
5 files changed, 74 insertions, 0 deletions
diff --git a/apps/issues/__init__.py b/apps/issues/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/apps/issues/__init__.py
diff --git a/apps/issues/forms.py b/apps/issues/forms.py
new file mode 100644
index 0000000..eee223f
--- /dev/null
+++ b/apps/issues/forms.py
@@ -0,0 +1,7 @@
+from django import forms
+from apps.issues.models import Issue
+
+
+class IssueForm(forms.ModelForm):
+ class Meta:
+ model = Issue
diff --git a/apps/issues/models.py b/apps/issues/models.py
new file mode 100644
index 0000000..bcded0c
--- /dev/null
+++ b/apps/issues/models.py
@@ -0,0 +1,33 @@
+from django.db import models
+from django.utils.translation import ugettext as _
+
+from apps.core.models import ServiceProvider
+from apps.checkin.models import ServiceOrder
+
+
+class Issue(models.Model):
+ sp = models.ForeignKey(ServiceProvider)
+ description = models.CharField(max_length=256, default=_('No power'))
+
+ def __unicode__(self):
+ return self.description
+
+ def get_absolute_url(self):
+ return '/manage/issues/%d/' % self.pk
+
+
+class Question(models.Model):
+ issue = models.ForeignKey(Issue)
+ question = models.CharField(max_length=256)
+ required = models.BooleanField(default=True)
+
+
+class Choice(models.Model):
+ question = models.ForeignKey(Question)
+ choice = models.CharField(max_length=256)
+
+
+class Answer(models.Model):
+ choice = models.ForeignKey(Choice)
+ answer = models.CharField(max_length=256)
+ so = models.ForeignKey(ServiceOrder)
diff --git a/apps/issues/tests.py b/apps/issues/tests.py
new file mode 100644
index 0000000..501deb7
--- /dev/null
+++ b/apps/issues/tests.py
@@ -0,0 +1,16 @@
+"""
+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)
diff --git a/apps/issues/views.py b/apps/issues/views.py
new file mode 100644
index 0000000..ed60ed7
--- /dev/null
+++ b/apps/issues/views.py
@@ -0,0 +1,18 @@
+from django.views.generic.list import ListView
+from django.views.generic.edit import FormView, CreateView, UpdateView
+from apps.core.views import DefaultEditView, DefaultListView
+from apps.issues.models import Issue
+
+
+class IssueListView(DefaultListView):
+ model = Issue
+
+
+class IssueCreateView(CreateView):
+ model = Issue
+ template_name = 'core/form.html'
+ success_url = '/manage/issues/'
+
+
+class IssueEditView(DefaultEditView):
+ model = Issue