add detail view
Signed-off-by: Nico Schottelius <nico@freiheit.schottelius.org>
This commit is contained in:
parent
7f7e5be1c6
commit
9350814f57
4 changed files with 25 additions and 4 deletions
11
digital_glarus/templates/digital_glarus/detail.html
Normal file
11
digital_glarus/templates/digital_glarus/detail.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
<h1>{{ message }}</h1>
|
||||
|
||||
<ul>
|
||||
<li>{{ message.name }}
|
||||
<li>{{ message.email }}
|
||||
<li>{{ message.phone_number }}
|
||||
<li>{{ message.message }}
|
||||
<li>{{ message.received_date }}
|
||||
</ul>
|
||||
|
||||
<p><a href="{% url 'digital_glarus:index' %}">Back to Main</a>
|
|
@ -4,6 +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'),
|
||||
url(r'send_message', views.send_message, name='send_message'),
|
||||
url(r'^(?P<message_id>[0-9]+)/$', views.detail, name='detail'),
|
||||
]
|
||||
|
|
|
@ -1,11 +1,21 @@
|
|||
from django.shortcuts import render
|
||||
|
||||
from django.shortcuts import render
|
||||
from django.shortcuts import get_object_or_404, render
|
||||
|
||||
|
||||
|
||||
from .models import Message
|
||||
|
||||
|
||||
def detail(request):
|
||||
pass
|
||||
|
||||
def detail(request, message_id):
|
||||
p = get_object_or_404(Message, pk=message_id)
|
||||
|
||||
context = { 'message': p, }
|
||||
return render(request, 'digital_glarus/detail.html', context)
|
||||
|
||||
def send_message(request):
|
||||
pass
|
||||
|
||||
|
|
|
@ -7,5 +7,5 @@ urlpatterns = [
|
|||
# url(r'^blog/', include('blog.urls')),
|
||||
|
||||
url(r'^admin/', include(admin.site.urls)),
|
||||
url(r'^digital.glarus/', include('digital_glarus.urls')),
|
||||
url(r'^digital.glarus/', include('digital_glarus.urls', namespace="digital_glarus")),
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue