
21 changed files with 357 additions and 2 deletions
@ -1,4 +1,4 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project version="4"> |
|||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (kinoostrov) (2)" project-jdk-type="Python SDK" /> |
|||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (kinoostrov)" project-jdk-type="Python SDK" /> |
|||
</project> |
@ -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",] |
@ -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')), |
|||
], |
|||
), |
|||
] |
@ -0,0 +1,30 @@ |
|||
{% extends "kinoostrov/base.html" %} |
|||
{% load static %} |
|||
|
|||
|
|||
|
|||
{% block content %} |
|||
<div class="row"> |
|||
{% for item in dotazy %} |
|||
|
|||
<div class="col-sm-3"> |
|||
<div class="card"> |
|||
{% if item.obrazek %} |
|||
<img src="{{ item.obrazek.url }}" class="card-img-top" alt="..."> |
|||
{% endif %} |
|||
<div class="card-body"> |
|||
<h5 class="card-title">{{ item.nazev }}</h5> |
|||
<p class="card-text">{{ item.popis }}</p> |
|||
</div> |
|||
<ul class="list-group list-group-flush"> |
|||
<li class="list-group-item">{{ item.ofilmu }}</li> |
|||
<li class="list-group-item"><b>Datum a čas promítání:</b> {{ item.datum }}</li> |
|||
<li class="list-group-item"><b>Režie:</b> {{ item.rezie }}</li> |
|||
|
|||
</ul> |
|||
</div> |
|||
</div> |
|||
|
|||
{% endfor %} |
|||
</div> |
|||
{% endblock %} |
@ -0,0 +1,31 @@ |
|||
{% extends "kinoostrov/base.html" %} |
|||
{%load add_css %} |
|||
|
|||
{% block content %} |
|||
<form action="{% url 'formular_akce' %}" method="POST" enctype="multipart/form-data"> |
|||
{% csrf_token %} |
|||
{% for field in form %} |
|||
{% if field.field.widget.input_type == "radio" %} |
|||
<div class="form-check form-check-inline"> |
|||
{{ field|add_css:"form-check-input" }} |
|||
<label class="form-check-label" for="{{ field.field.id }}">{{ field.label_tag.label }}</label> |
|||
</div> |
|||
{% else %} |
|||
{{ field.errors }} |
|||
<div class="form-group"> |
|||
{{ field.label_tag }} |
|||
{{ field|add_css:"form-control" }} |
|||
</div> |
|||
{% endif %} |
|||
{% endfor %} |
|||
<br> |
|||
<div class="buttonBox"> |
|||
<input type="submit" value="Odeslat" class="btn btn-success"> |
|||
</div> |
|||
</form> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
{% endblock %} |
@ -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") |
|||
] |
|||
|
@ -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')), |
|||
], |
|||
), |
|||
] |
@ -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), |
|||
), |
|||
] |
@ -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), |
|||
), |
|||
] |
@ -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, |
|||
), |
|||
] |
@ -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, |
|||
), |
|||
] |
@ -0,0 +1,13 @@ |
|||
{% extends "kinoostrov/base.html" %} |
|||
{% load static %} |
|||
|
|||
|
|||
|
|||
{% block content %} |
|||
{% for foto in item.foto_set.all %} |
|||
{% if foto.obrazek %} |
|||
<img src="{{ foto.obrazek.url }}" alt=""> |
|||
{% endif %} |
|||
{% endfor %} |
|||
|
|||
{% endblock %} |
@ -0,0 +1,24 @@ |
|||
{% extends "kinoostrov/base.html" %} |
|||
{% load static %} |
|||
|
|||
|
|||
|
|||
{% block content %} |
|||
<div class="row"> |
|||
{% for item in dotazy %} |
|||
|
|||
<div class="col-sm-3"> |
|||
<div class="card"> |
|||
{% if item.obrazek %} |
|||
<a href="{% url 'alba' item.id %}"><img src="{{ item.obrazek.url }}" class="card-img-top" alt="..."></a> |
|||
{% endif %} |
|||
<div class="card-body"> |
|||
<h5 class="card-title" style="text-align: center">{{ item.nazev }}</h5> |
|||
</div> |
|||
</ul> |
|||
</div> |
|||
</div> |
|||
|
|||
{% endfor %} |
|||
</div> |
|||
{% endblock %} |
@ -0,0 +1,9 @@ |
|||
from django.urls import path |
|||
from galerie import views |
|||
|
|||
urlpatterns = [ |
|||
path("", views.galerie,name="galerie"), |
|||
path('alba/<int:message_id>', views.alba, name="alba"), |
|||
|
|||
] |
|||
|
After Width: | Height: | Size: 28 KiB |
@ -0,0 +1,9 @@ |
|||
from django import forms |
|||
|
|||
from kolotoc.models import Kolotoc |
|||
|
|||
|
|||
class Formular(forms.ModelForm): |
|||
class Meta: |
|||
model = Kolotoc |
|||
fields = ["popisek","obrazek"] |
@ -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, |
|||
), |
|||
] |
@ -0,0 +1,26 @@ |
|||
{% extends "kinoostrov/base.html" %} |
|||
{% load add_css %} |
|||
{% block content %} |
|||
|
|||
|
|||
<form action="{% url 'formular_kolotoc' %}" method="POST" enctype="multipart/form-data"> |
|||
{% csrf_token %} |
|||
{% for field in form %} |
|||
{% if field.field.widget.input_type == "radio" %} |
|||
<div class="form-check form-check-inline"> |
|||
{{ field|add_css:"form-check-input" }} |
|||
<label class="form-check-label" for="{{ field.field.id }}">{{ field.label_tag.label }}</label> |
|||
</div> |
|||
{% else %} |
|||
{{ field.errors }} |
|||
<div class="form-group"> |
|||
{{ field.label_tag }} |
|||
{{ field|add_css:"form-control" }} |
|||
</div> |
|||
{% endif %} |
|||
{% endfor %} |
|||
<div class="buttonBox"> |
|||
<input type="submit" value="Odeslat" class="btn btn-success"> |
|||
</div> |
|||
</form> |
|||
{% endblock %} |
@ -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)}) |
@ -0,0 +1,9 @@ |
|||
from django.urls import path |
|||
from kolotoc import views |
|||
|
|||
urlpatterns = [ |
|||
path("", views.formular,name="formular_kolotoc"), |
|||
|
|||
|
|||
] |
|||
|
Loading…
Reference in new issue