From 351938c52029f564710a87967ba82ed3e203bb35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20=C5=A0krab=C3=A1nek?= Date: Fri, 26 Nov 2021 09:35:12 +0100 Subject: [PATCH] novinka --- databaze/urls.py | 3 ++- novinky/templates/novinky/index.html | 3 ++- novinky/templates/novinky/novinka.html | 10 ++++++++++ novinky/views.py | 4 ++++ 4 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 novinky/templates/novinky/novinka.html diff --git a/databaze/urls.py b/databaze/urls.py index bf4d93d..3a13808 100644 --- a/databaze/urls.py +++ b/databaze/urls.py @@ -16,8 +16,9 @@ Including another URLconf from django.contrib import admin from django.urls import path -from novinky.views import index +from novinky.views import index,novinka urlpatterns = [ path('admin/', admin.site.urls), + path('novinka//', novinka, name="novinka"), path('', index, name="index"), ] diff --git a/novinky/templates/novinky/index.html b/novinky/templates/novinky/index.html index 7fbc8ae..5edc611 100644 --- a/novinky/templates/novinky/index.html +++ b/novinky/templates/novinky/index.html @@ -8,7 +8,8 @@ {{ novinka.autor }}
{{ novinka.datum }}

- {{ novinka.zprava }} + {{ novinka.zprava|truncatewords:5 }} + vice

{% endfor %} diff --git a/novinky/templates/novinky/novinka.html b/novinky/templates/novinky/novinka.html new file mode 100644 index 0000000..d9fbb12 --- /dev/null +++ b/novinky/templates/novinky/novinka.html @@ -0,0 +1,10 @@ +{% extends "novinky/base.html" %} + + +{% block content %} + +

Zde nic neni

+ +zpět + +{% endblock %} \ No newline at end of file diff --git a/novinky/views.py b/novinky/views.py index 2427903..15b19d1 100644 --- a/novinky/views.py +++ b/novinky/views.py @@ -10,3 +10,7 @@ def index(request): "novinky": novinky, } return render(request, "novinky/index.html", context) + + +def novinka(request, novinka_id): + return render(request, "novinky/novinka.html") \ No newline at end of file