From 7f7e5be1c60e93e38f612c67ba5f592dc7b00fd3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 2 May 2015 17:42:04 +0200 Subject: [PATCH] begin form creation Signed-off-by: Nico Schottelius --- .../templates/digital_glarus/index.html | 19 +++++++++++++++++++ digital_glarus/urls.py | 2 ++ digital_glarus/views.py | 13 +++++++++++-- 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 digital_glarus/templates/digital_glarus/index.html diff --git a/digital_glarus/templates/digital_glarus/index.html b/digital_glarus/templates/digital_glarus/index.html new file mode 100644 index 00000000..2e9980b3 --- /dev/null +++ b/digital_glarus/templates/digital_glarus/index.html @@ -0,0 +1,19 @@ +{% if error_message %}

{{ error_message }}

{% endif %} + +
+{% csrf_token %} + + +
+ +{% if message_list %} + +{% else %} +

No messages are available.

+{% endif %} + + diff --git a/digital_glarus/urls.py b/digital_glarus/urls.py index a3780aa2..aa036dd0 100644 --- a/digital_glarus/urls.py +++ b/digital_glarus/urls.py @@ -4,4 +4,6 @@ from . import views urlpatterns = [ url(r'^$', views.index, name='index'), + url(r'/send_message', views.send_message, name='send_message'), +# url(r'^(?P[0-9]+)/$', views.detail, name='detail'), ] diff --git a/digital_glarus/views.py b/digital_glarus/views.py index 65ed4fcc..96986ed2 100644 --- a/digital_glarus/views.py +++ b/digital_glarus/views.py @@ -1,6 +1,15 @@ from django.shortcuts import render -from django.http import HttpResponse +from django.shortcuts import render + + +from .models import Message + + +def send_message(request): + pass def index(request): - return HttpResponse("Hello, world. You're at the polls index.") + message_list = Message.objects.order_by('-received_date')[:5] + context = { 'message_list': message_list, } + return render(request, 'digital_glarus/index.html', context)