begin form creation

Signed-off-by: Nico Schottelius <nico@freiheit.schottelius.org>
This commit is contained in:
Nico Schottelius 2015-05-02 17:42:04 +02:00
parent 5d1b26d4f7
commit 7f7e5be1c6
3 changed files with 32 additions and 2 deletions

View file

@ -0,0 +1,19 @@
{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}
<form action="{% url 'digital_glarus:send_message' %}" method="post">
{% csrf_token %}
<input type="submit" value="Send Message" />
</form>
{% if message_list %}
<ul>
{% for message in message_list %}
<li><a href="/digital.glarus/{{ message.id }}/">{{ message }}</a></li>
{% endfor %}
</ul>
{% else %}
<p>No messages are available.</p>
{% endif %}

View file

@ -4,4 +4,6 @@ from . import views
urlpatterns = [ urlpatterns = [
url(r'^$', views.index, name='index'), url(r'^$', views.index, name='index'),
url(r'/send_message', views.send_message, name='send_message'),
# url(r'^(?P<message_id>[0-9]+)/$', views.detail, name='detail'),
] ]

View file

@ -1,6 +1,15 @@
from django.shortcuts import render 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): 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)