begin form creation
Signed-off-by: Nico Schottelius <nico@freiheit.schottelius.org>
This commit is contained in:
parent
5d1b26d4f7
commit
7f7e5be1c6
3 changed files with 32 additions and 2 deletions
19
digital_glarus/templates/digital_glarus/index.html
Normal file
19
digital_glarus/templates/digital_glarus/index.html
Normal 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 %}
|
||||
|
||||
|
|
@ -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<message_id>[0-9]+)/$', views.detail, name='detail'),
|
||||
]
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue