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)