aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/issues/views.py9
-rw-r--r--fixtures.json18
-rw-r--r--motor/urls.py7
-rw-r--r--templates/issues/index.html32
4 files changed, 63 insertions, 3 deletions
diff --git a/apps/issues/views.py b/apps/issues/views.py
index ed60ed7..565bc6e 100644
--- a/apps/issues/views.py
+++ b/apps/issues/views.py
@@ -1,3 +1,5 @@
+import json
+from django.shortcuts import render
from django.views.generic.list import ListView
from django.views.generic.edit import FormView, CreateView, UpdateView
from apps.core.views import DefaultEditView, DefaultListView
@@ -16,3 +18,10 @@ class IssueCreateView(CreateView):
class IssueEditView(DefaultEditView):
model = Issue
+
+
+def list_issues(request, idx=0):
+ fh = open('fixtures.json', 'r')
+ data = json.loads(fh.read())
+ question = data['questions'][int(idx)]
+ return render(request, "issues/index.html", question)
diff --git a/fixtures.json b/fixtures.json
new file mode 100644
index 0000000..11b6b79
--- /dev/null
+++ b/fixtures.json
@@ -0,0 +1,18 @@
+{
+ "questions": [
+ {
+ "pk": "1",
+ "order": "0",
+ "question": "Accidental damage?",
+ "choices": [{"pk": "1", "choice": "Yes"}, {"pk": "2", "choice": "No"}],
+ "required": "True"
+ },
+ {
+ "pk": "2",
+ "order": "1",
+ "question": "Something else?",
+ "choices": [{"pk": "3", "choice": "Yes"}, {"pk": "4", "choice": "No"}],
+ "required": "True"
+ }
+ ]
+}
diff --git a/motor/urls.py b/motor/urls.py
index 39822d7..9ec4845 100644
--- a/motor/urls.py
+++ b/motor/urls.py
@@ -6,6 +6,8 @@ from apps.issues.views import *
urlpatterns = patterns(
'',
#url(r'^$', 'docs.views.index', name='docs-index'),
+ url(r'^$', list_issues, name='issues-index'),
+ url(r'^(\d+)/$', list_issues, name='issues-index'),
url(r'^manage/$', LoginView.as_view(), name='core-login'),
url(r'^manage/logout/$', logout, name='core-logout'),
url(r'^manage/docs/$', ArticleListView.as_view(), name='core-list_docs'),
@@ -20,8 +22,7 @@ urlpatterns = patterns(
url(r'^manage/issues/$', IssueListView.as_view(), name='issues-list_issues'),
url(r'^manage/issues/add/$', IssueCreateView.as_view(), name='issues-add_issue'),
url(r'^manage/issues/(?P<pk>\d+)/$', IssueEditView.as_view(), name='issues-edit_issue'),
- url(r'^terms/$', TemplateView.as_view(template_name="terms.html"),
- {'title': 'ServoApp Terms of Service'}),
+ url(r'^terms/$', TemplateView.as_view(template_name="terms.html"), {'title': 'ServoApp Terms of Service'}),
#(r'^admin/', include(admin.site.urls)),
- url(r'^([\w\-]+)/$', 'docs.views.view_article', name='docs-view'),
+ #url(r'^([\w\-]+)/$', 'docs.views.view_article', name='docs-view'),
)
diff --git a/templates/issues/index.html b/templates/issues/index.html
new file mode 100644
index 0000000..15b341f
--- /dev/null
+++ b/templates/issues/index.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>{{ title }}</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <!-- Bootstrap -->
+ <link href="{{ STATIC_URL }}bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
+ <link href="{{ STATIC_URL }}bootstrap/css/bootstrap-theme.min.css" rel="stylesheet" media="screen">
+ <link href="{{ STATIC_URL }}css/signin.css" rel="stylesheet" media="screen">
+ <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
+ <!--[if lt IE 9]>
+ <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+ <body style="padding-top:50px">
+ <div class="container-fluid">
+ {% block main %}
+ <h2>{{ question }}</h2>
+ {% for i in choices %}
+ <a class="btn btn-default" href="{% url 'issues-index' i.pk %}">{{ i.choice }}</a>
+ {% endfor %}
+ <blockquote>{{ dump }}</blockquote>
+ {% endblock main %}
+ </div><!-- /container -->
+ <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
+ <script src="{{ STATIC_URL }}js/jquery.min.js"></script>
+ <!-- Include all compiled plugins (below), or include individual files as needed -->
+ <script src="{{ STATIC_URL }}bootstrap/js/bootstrap.min.js"></script>
+ </body>
+</html>