diff --git a/databaze/urls.py b/databaze/urls.py index c3014a8..9b580fd 100644 --- a/databaze/urls.py +++ b/databaze/urls.py @@ -15,9 +15,10 @@ Including another URLconf """ from django.contrib import admin from django.urls import path -from novinky.views import index +from novinky.views import index, newitem urlpatterns = [ path('admin/', admin.site.urls), + path('novinka//', newitem, name="newitem"), path('', index, name="index"), ] diff --git a/novinky/templates/novinky/index.html b/novinky/templates/novinky/index.html index a2e8e9c..c2b938b 100644 --- a/novinky/templates/novinky/index.html +++ b/novinky/templates/novinky/index.html @@ -10,6 +10,9 @@

{{ novinka.zprava|truncatewords:10 }}

+

+ číst dál +

{% endfor %} {% endblock %} \ No newline at end of file diff --git a/novinky/templates/novinky/newitem.html b/novinky/templates/novinky/newitem.html new file mode 100644 index 0000000..b1ec2ab --- /dev/null +++ b/novinky/templates/novinky/newitem.html @@ -0,0 +1,14 @@ +{% extends "novinky/base.html" %} + +{% block content %} +

{{ novinka.titulek }}

+ {{ novinka.datum|date:"j. E Y G:i" }}
+ {{ novinka.autor }} +

+ {{ novinka.zprava }} +

+

+ zpět +

+ +{% endblock %} diff --git a/novinky/views.py b/novinky/views.py index 9877ccd..b5a4407 100644 --- a/novinky/views.py +++ b/novinky/views.py @@ -8,3 +8,11 @@ def index(request): "novinky": novinky, } return render(request, "novinky/index.html", context) + + +def newitem(request, new_id): + novinka = Novinka.objects.get(id=new_id) + context = { + "novinka": novinka, + } + return render(request, "novinky/newitem.html", context)