diff --git a/digital_glarus/templates/digital_glarus/detail.html b/digital_glarus/templates/digital_glarus/detail.html new file mode 100644 index 00000000..77d404ce --- /dev/null +++ b/digital_glarus/templates/digital_glarus/detail.html @@ -0,0 +1,11 @@ +

{{ message }}

+ + + +

Back to Main diff --git a/digital_glarus/urls.py b/digital_glarus/urls.py index aa036dd0..1c6a5b83 100644 --- a/digital_glarus/urls.py +++ b/digital_glarus/urls.py @@ -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[0-9]+)/$', views.detail, name='detail'), + 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 96986ed2..95da6bb8 100644 --- a/digital_glarus/views.py +++ b/digital_glarus/views.py @@ -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 diff --git a/dynamicweb/urls.py b/dynamicweb/urls.py index dfb7a04b..dc7bef66 100644 --- a/dynamicweb/urls.py +++ b/dynamicweb/urls.py @@ -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")), ]