Browse Source

index pro novinky

master
Pavel Škrabánek 4 years ago
parent
commit
a8449b4096
  1. 2
      databaze/urls.py
  2. 3
      novinky/models.py
  3. 14
      novinky/templates/novinky/base.html
  4. 0
      novinky/templates/novinky/index.html
  5. 2
      novinky/views.py

2
databaze/urls.py

@ -16,6 +16,8 @@ Including another URLconf
from django.contrib import admin from django.contrib import admin
from django.urls import path from django.urls import path
from novinky.views import index
urlpatterns = [ urlpatterns = [
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('', index, name="index")
] ]

3
novinky/models.py

@ -8,6 +8,9 @@ class Novinka(models.Model):
datum = models.DateTimeField() datum = models.DateTimeField()
autor = models.ForeignKey(User, on_delete=models.CASCADE) autor = models.ForeignKey(User, on_delete=models.CASCADE)
def __str__(self) -> str:
return self.titulek
class Meta: class Meta:
verbose_name = "Novinka" verbose_name = "Novinka"
verbose_name_plural = "novinky" verbose_name_plural = "novinky"

14
novinky/templates/novinky/base.html

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="cs">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
{% block content %}
(nic tu zatim neni)
{% endblock %}
</body>
</html>

0
novinky/templates/novinky/index.html

2
novinky/views.py

@ -1,3 +1,5 @@
from django.shortcuts import render from django.shortcuts import render
# Create your views here. # Create your views here.
def index(request):
return render(request, "novinky/index.html")

Loading…
Cancel
Save