diff --git a/.idea/kinoostrov.iml b/.idea/kinoostrov.iml index cdbba06..b99792b 100644 --- a/.idea/kinoostrov.iml +++ b/.idea/kinoostrov.iml @@ -16,7 +16,7 @@ - + diff --git a/.idea/misc.xml b/.idea/misc.xml index ffe629d..0f0a89c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/akce/forms.py b/akce/forms.py new file mode 100644 index 0000000..eb4b41c --- /dev/null +++ b/akce/forms.py @@ -0,0 +1,9 @@ +from django import forms + +from akce.models import Akce + + +class Formular(forms.ModelForm): + class Meta: + model = Akce + fields = ["nazev","popis","datum","ofilmu","rezie","obrazek",] diff --git a/akce/migrations/0001_initial.py b/akce/migrations/0001_initial.py new file mode 100644 index 0000000..ed0cc4c --- /dev/null +++ b/akce/migrations/0001_initial.py @@ -0,0 +1,26 @@ +# Generated by Django 3.2 on 2021-05-13 19:28 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Akce', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('nazev', models.CharField(max_length=64, verbose_name='Název')), + ('popis', models.CharField(max_length=256, verbose_name='Popis')), + ('datum', models.DateTimeField(verbose_name='Datum+Čas')), + ('ofilmu', models.CharField(max_length=256, verbose_name='O filmu')), + ('rezie', models.CharField(max_length=32, verbose_name='Režie')), + ('obrazek', models.ImageField(upload_to='akce', verbose_name='Obrázek')), + ], + ), + ] diff --git a/akce/templates/akce/akce.html b/akce/templates/akce/akce.html new file mode 100644 index 0000000..7b4c732 --- /dev/null +++ b/akce/templates/akce/akce.html @@ -0,0 +1,30 @@ +{% extends "kinoostrov/base.html" %} +{% load static %} + + + +{% block content %} +
+ {% for item in dotazy %} + +
+
+ {% if item.obrazek %} + ... + {% endif %} +
+
{{ item.nazev }}
+

{{ item.popis }}

+
+
    +
  • {{ item.ofilmu }}
  • +
  • Datum a čas promítání: {{ item.datum }}
  • +
  • Režie: {{ item.rezie }}
  • + +
+
+
+ + {% endfor %} +
+{% endblock %} \ No newline at end of file diff --git a/akce/templates/akce/formular_akce.html b/akce/templates/akce/formular_akce.html new file mode 100644 index 0000000..5e304f3 --- /dev/null +++ b/akce/templates/akce/formular_akce.html @@ -0,0 +1,31 @@ +{% extends "kinoostrov/base.html" %} +{%load add_css %} + +{% block content %} +
+ {% csrf_token %} + {% for field in form %} + {% if field.field.widget.input_type == "radio" %} +
+ {{ field|add_css:"form-check-input" }} + +
+ {% else %} + {{ field.errors }} +
+ {{ field.label_tag }} + {{ field|add_css:"form-control" }} +
+ {% endif %} + {% endfor %} +
+
+ +
+
+ + + + + +{% endblock %} \ No newline at end of file diff --git a/akce/urls.py b/akce/urls.py new file mode 100644 index 0000000..6c9d68d --- /dev/null +++ b/akce/urls.py @@ -0,0 +1,10 @@ + +from django.contrib import admin +from django.urls import path +from akce import views + +urlpatterns = [ + path("", views.akce,name="akce"), + path("formular/",views.form,name="formular_akce") +] + diff --git a/galerie/migrations/0001_initial.py b/galerie/migrations/0001_initial.py new file mode 100644 index 0000000..6b38763 --- /dev/null +++ b/galerie/migrations/0001_initial.py @@ -0,0 +1,31 @@ +# Generated by Django 3.2 on 2021-05-17 11:36 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Album', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('nazev', models.CharField(max_length=64, verbose_name='Název alba')), + ('datum', models.DateTimeField(verbose_name='Datum+Čas')), + ('obrazek', models.ImageField(upload_to='album', verbose_name='Obrázek')), + ], + ), + migrations.CreateModel( + name='Foto', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('album', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='galerie.album')), + ], + ), + ] diff --git a/galerie/migrations/0002_alter_album_datum.py b/galerie/migrations/0002_alter_album_datum.py new file mode 100644 index 0000000..66b2162 --- /dev/null +++ b/galerie/migrations/0002_alter_album_datum.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2 on 2021-05-17 11:40 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('galerie', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='album', + name='datum', + field=models.DateTimeField(blank=True), + ), + ] diff --git a/galerie/migrations/0003_alter_album_datum.py b/galerie/migrations/0003_alter_album_datum.py new file mode 100644 index 0000000..bced06b --- /dev/null +++ b/galerie/migrations/0003_alter_album_datum.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2 on 2021-05-17 11:44 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('galerie', '0002_alter_album_datum'), + ] + + operations = [ + migrations.AlterField( + model_name='album', + name='datum', + field=models.DateTimeField(blank=True, null=True), + ), + ] diff --git a/galerie/migrations/0004_alter_album_datum.py b/galerie/migrations/0004_alter_album_datum.py new file mode 100644 index 0000000..e691b67 --- /dev/null +++ b/galerie/migrations/0004_alter_album_datum.py @@ -0,0 +1,20 @@ +# Generated by Django 3.2 on 2021-05-17 11:45 + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('galerie', '0003_alter_album_datum'), + ] + + operations = [ + migrations.AlterField( + model_name='album', + name='datum', + field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), + preserve_default=False, + ), + ] diff --git a/galerie/migrations/0005_auto_20210518_2013.py b/galerie/migrations/0005_auto_20210518_2013.py new file mode 100644 index 0000000..d30f4f1 --- /dev/null +++ b/galerie/migrations/0005_auto_20210518_2013.py @@ -0,0 +1,32 @@ +# Generated by Django 3.2 on 2021-05-18 18:13 + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('galerie', '0004_alter_album_datum'), + ] + + operations = [ + migrations.AddField( + model_name='foto', + name='autor', + field=models.CharField(default=django.utils.timezone.now, max_length=64, verbose_name='Autor Fotky'), + preserve_default=False, + ), + migrations.AddField( + model_name='foto', + name='obrazek', + field=models.ImageField(default=django.utils.timezone.now, upload_to='album', verbose_name='Obrázek'), + preserve_default=False, + ), + migrations.AddField( + model_name='foto', + name='popisek', + field=models.CharField(default=django.utils.timezone.now, max_length=64, verbose_name='Popisek'), + preserve_default=False, + ), + ] diff --git a/galerie/templates/galerie/alba.html b/galerie/templates/galerie/alba.html new file mode 100644 index 0000000..ce80bc0 --- /dev/null +++ b/galerie/templates/galerie/alba.html @@ -0,0 +1,13 @@ +{% extends "kinoostrov/base.html" %} +{% load static %} + + + +{% block content %} + {% for foto in item.foto_set.all %} + {% if foto.obrazek %} + + {% endif %} + {% endfor %} + +{% endblock %} \ No newline at end of file diff --git a/galerie/templates/galerie/galerie.html b/galerie/templates/galerie/galerie.html new file mode 100644 index 0000000..68ab53c --- /dev/null +++ b/galerie/templates/galerie/galerie.html @@ -0,0 +1,24 @@ +{% extends "kinoostrov/base.html" %} +{% load static %} + + + +{% block content %} +
+ {% for item in dotazy %} + +
+
+ {% if item.obrazek %} + ... + {% endif %} +
+
{{ item.nazev }}
+
+ +
+
+ + {% endfor %} +
+{% endblock %} \ No newline at end of file diff --git a/galerie/urls.py b/galerie/urls.py new file mode 100644 index 0000000..d8b094e --- /dev/null +++ b/galerie/urls.py @@ -0,0 +1,9 @@ +from django.urls import path +from galerie import views + +urlpatterns = [ + path("", views.galerie,name="galerie"), + path('alba/', views.alba, name="alba"), + +] + diff --git a/kinoostrov/static/kinoostrov/img/Ghoul_2015_film_poster.jpg b/kinoostrov/static/kinoostrov/img/Ghoul_2015_film_poster.jpg new file mode 100644 index 0000000..1a675a6 Binary files /dev/null and b/kinoostrov/static/kinoostrov/img/Ghoul_2015_film_poster.jpg differ diff --git a/kolotoc/forms.py b/kolotoc/forms.py new file mode 100644 index 0000000..84d38ac --- /dev/null +++ b/kolotoc/forms.py @@ -0,0 +1,9 @@ +from django import forms + +from kolotoc.models import Kolotoc + + +class Formular(forms.ModelForm): + class Meta: + model = Kolotoc + fields = ["popisek","obrazek"] \ No newline at end of file diff --git a/kolotoc/migrations/0007_alter_kolotoc_obrazek.py b/kolotoc/migrations/0007_alter_kolotoc_obrazek.py new file mode 100644 index 0000000..36b1450 --- /dev/null +++ b/kolotoc/migrations/0007_alter_kolotoc_obrazek.py @@ -0,0 +1,20 @@ +# Generated by Django 3.2 on 2021-05-13 19:28 + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('kolotoc', '0006_kolotoc_obrazek'), + ] + + operations = [ + migrations.AlterField( + model_name='kolotoc', + name='obrazek', + field=models.ImageField(default=django.utils.timezone.now, upload_to='kolotoc', verbose_name='Obrázek'), + preserve_default=False, + ), + ] diff --git a/kolotoc/templates/kolotoc/formular.html b/kolotoc/templates/kolotoc/formular.html new file mode 100644 index 0000000..face823 --- /dev/null +++ b/kolotoc/templates/kolotoc/formular.html @@ -0,0 +1,26 @@ +{% extends "kinoostrov/base.html" %} +{% load add_css %} +{% block content %} + + +
+ {% csrf_token %} + {% for field in form %} + {% if field.field.widget.input_type == "radio" %} +
+ {{ field|add_css:"form-check-input" }} + +
+ {% else %} + {{ field.errors }} +
+ {{ field.label_tag }} + {{ field|add_css:"form-control" }} +
+ {% endif %} + {% endfor %} +
+ +
+
+{% endblock %} \ No newline at end of file diff --git a/kolotoc/templatetags/add_css.py b/kolotoc/templatetags/add_css.py new file mode 100644 index 0000000..e17a385 --- /dev/null +++ b/kolotoc/templatetags/add_css.py @@ -0,0 +1,20 @@ +from django import template + +register = template.Library() + + +@register.filter(name='add_css') +def add_css(field, arg): + css_classes = field.field.widget.attrs.get('class', '') + + if css_classes: + css_classes = css_classes.split(' ') + else: + css_classes = [] + + args = arg.split(' ') + for a in args: + if a not in css_classes: + css_classes.append(a) + + return field.as_widget(attrs={'class': ' '.join(css_classes)}) diff --git a/kolotoc/urls.py b/kolotoc/urls.py new file mode 100644 index 0000000..a319555 --- /dev/null +++ b/kolotoc/urls.py @@ -0,0 +1,9 @@ +from django.urls import path +from kolotoc import views + +urlpatterns = [ + path("", views.formular,name="formular_kolotoc"), + + +] +