Browse Source

Merge branch 'data_migrations' of gimli.ms.mff.cuni.cz:/akce/mam/git/mamweb into data_migrations

export_seznamu_prednasek
Anet 5 years ago
parent
commit
050ecc5bc8
  1. 36
      galerie/static/galerie/prvky/dalsi.svg
  2. 38
      galerie/static/galerie/prvky/predchozi.svg
  3. 19
      seminar/migrations/0082_auto_20200506_1951.py
  4. 19
      seminar/migrations/0083_auto_20200506_1952.py
  5. 5
      seminar/models.py
  6. 10
      seminar/static/seminar/prihlaska.js
  7. 18
      seminar/templates/seminar/archiv/temata.html
  8. 89
      seminar/templates/seminar/edit.html
  9. 7
      seminar/templates/seminar/login.html
  10. 168
      seminar/templates/seminar/prihlaska.html
  11. 27
      seminar/templates/seminar/prihlaska_field.html
  12. 5
      seminar/urls.py
  13. 14
      seminar/views/views_all.py

36
galerie/static/galerie/prvky/dalsi.svg

@ -5,11 +5,39 @@
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="25.135418mm" width="25.135418mm"
height="42.333332mm" height="42.333332mm"
viewBox="0 0 25.135418 42.333331" viewBox="0 0 25.135418 42.333331"
version="1.1" version="1.1"
id="svg851"> id="svg851"
sodipodi:docname="dalsi.svg"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1850"
inkscape:window-height="1136"
id="namedview7"
showgrid="true"
inkscape:zoom="23.600001"
inkscape:cx="18.587131"
inkscape:cy="74.924864"
inkscape:window-x="70"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="svg851">
<inkscape:grid
type="xygrid"
id="grid833" />
</sodipodi:namedview>
<defs <defs
id="defs845" /> id="defs845" />
<metadata <metadata
@ -28,8 +56,10 @@
id="layer1" id="layer1"
transform="matrix(-1.0282842,0,0,1,111.4545,-88.415317)"> transform="matrix(-1.0282842,0,0,1,111.4545,-88.415317)">
<path <path
d="m 108.38881,88.415317 -6.43264,21.166663 6.43264,21.16667 -18.011397,-21.16667 z" d="m 98.096584,101.64448 1.286528,1.32292 -5.660724,5.82083 h 13.379892 v 1.5875 H 93.722388 l 5.660724,5.82083 -1.286528,1.32292 -7.719171,-7.9375 z"
style="fill:#e84e10;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.23177969" style="fill:#e84e10;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.23177969"
id="path44-3" /> id="path44-3"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccccc" />
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

38
galerie/static/galerie/prvky/predchozi.svg

@ -5,11 +5,39 @@
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="25.135418mm" width="25.135418mm"
height="42.333332mm" height="42.333332mm"
viewBox="0 0 25.135418 42.333331" viewBox="0 0 25.135418 42.333331"
version="1.1" version="1.1"
id="svg851"> id="svg851"
sodipodi:docname="predchozi.svg"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1850"
inkscape:window-height="1136"
id="namedview7"
showgrid="true"
inkscape:zoom="4.1719301"
inkscape:cx="124.03002"
inkscape:cy="97.874031"
inkscape:window-x="70"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="svg851">
<inkscape:grid
type="xygrid"
id="grid833" />
</sodipodi:namedview>
<defs <defs
id="defs845" /> id="defs845" />
<metadata <metadata
@ -26,10 +54,12 @@
</metadata> </metadata>
<g <g
id="layer1" id="layer1"
transform="matrix(-1.0282842,0,0,1,111.4545,-88.415317)"> transform="matrix(1.0282842,0,0,1,-86.319083,-88.415315)">
<path <path
d="m 83.944774,88.415319 6.43264,21.166661 -6.43264,21.16667 18.011396,-21.16667 z" d="m 98.096584,101.64448 1.286528,1.32292 -5.660724,5.82083 h 13.379892 v 1.5875 H 93.722388 l 5.660724,5.82083 -1.286528,1.32292 -7.719171,-7.9375 z"
style="fill:#e84e10;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.23177969" style="fill:#e84e10;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.23177969"
id="path44-3" /> id="path44-3"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccccc" />
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

19
seminar/migrations/0082_auto_20200506_1951.py

@ -0,0 +1,19 @@
# Generated by Django 2.2.12 on 2020-05-06 17:51
from django.db import migrations, models
import seminar.models
class Migration(migrations.Migration):
dependencies = [
('seminar', '0081_auto_20200408_2221'),
]
operations = [
migrations.AlterField(
model_name='cislo',
name='titulka_nahled',
field=models.ImageField(blank=True, help_text='Obrázek titulní strany, generuje se automaticky', null=True, upload_to=seminar.models.cislo_png_filename, verbose_name='Obrázek titulní strany'),
),
]

19
seminar/migrations/0083_auto_20200506_1952.py

@ -0,0 +1,19 @@
# Generated by Django 2.2.12 on 2020-05-06 17:52
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('seminar', '0082_auto_20200506_1951'),
]
operations = [
migrations.AlterField(
model_name='treenode',
name='first_child',
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='father_of_first', to='seminar.TreeNode', verbose_name='první potomek'),
),
]

5
seminar/models.py

@ -14,6 +14,7 @@ from django.utils.text import slugify
from django.urls import reverse from django.urls import reverse
from django.core.cache import cache from django.core.cache import cache
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.contrib.contenttypes.models import ContentType
from django.utils.text import get_valid_filename from django.utils.text import get_valid_filename
from imagekit.models import ImageSpecField, ProcessedImageField from imagekit.models import ImageSpecField, ProcessedImageField
from imagekit.processors import ResizeToFit, Transpose from imagekit.processors import ResizeToFit, Transpose
@ -1304,6 +1305,10 @@ class TreeNode(PolymorphicModel):
def aktualizuj_nazev(self): def aktualizuj_nazev(self):
raise NotImplementedError("Pokus o aktualizaci názvu obecného TreeNode místo konkrétní instance") raise NotImplementedError("Pokus o aktualizaci názvu obecného TreeNode místo konkrétní instance")
def get_admin_url(self):
content_type = ContentType.objects.get_for_model(self.__class__)
return reverse("admin:%s_%s_change" % (content_type.app_label, content_type.model), args=(self.id,))
class RocnikNode(TreeNode): class RocnikNode(TreeNode):
class Meta: class Meta:
db_table = 'seminar_nodes_rocnik' db_table = 'seminar_nodes_rocnik'

10
seminar/static/seminar/prihlaska.js

@ -3,7 +3,7 @@ function addrCountryChanged(){
var stat_text = document.getElementById('id_li_stat_text'); var stat_text = document.getElementById('id_li_stat_text');
var stat = stat_select[stat_select.selectedIndex].value; var stat = stat_select[stat_select.selectedIndex].value;
if (stat === "other"){ if (stat === "other"){
stat_text.style.display="block"; stat_text.style.display="revert";
} else { } else {
stat_text.style.display="none"; stat_text.style.display="none";
$('#id_stat_text').val(""); $('#id_stat_text').val("");
@ -12,18 +12,22 @@ function addrCountryChanged(){
function hideSchoolTextfields(){ function hideSchoolTextfields(){
var skola_nazev = document.getElementById('id_li_skola_nazev'); var skola_nazev = document.getElementById('id_li_skola_nazev');
var skola_adresa = document.getElementById('id_li_skola_adresa'); var skola_adresa = document.getElementById('id_li_skola_adresa');
var skola_vypln = document.getElementById('id_li_skola_vypln');
skola_nazev.style.display="none"; skola_nazev.style.display="none";
skola_adresa.style.display="none"; skola_adresa.style.display="none";
skola_vypln.style.display="none";
} }
function schoolNotInList(){ function schoolNotInList(){
var skola_nazev = document.getElementById('id_li_skola_nazev'); var skola_nazev = document.getElementById('id_li_skola_nazev');
var skola_adresa = document.getElementById('id_li_skola_adresa'); var skola_adresa = document.getElementById('id_li_skola_adresa');
var skola_vypln = document.getElementById('id_li_skola_vypln');
// FIXME nefunguje a nevim proc (TypeError: $(...).select2 is not a function) // FIXME nefunguje a nevim proc (TypeError: $(...).select2 is not a function)
//var skola_select = $('#id_skola').select2(); //var skola_select = $('#id_skola').select2();
//skola_select.val(null).trigger('change'); //skola_select.val(null).trigger('change');
skola_nazev.style.display="block"; skola_vypln.style.display="revert";
skola_adresa.style.display="block"; skola_nazev.style.display="revert";
skola_adresa.style.display="revert";
} }
document.addEventListener("DOMContentLoaded", function(){ document.addEventListener("DOMContentLoaded", function(){

18
seminar/templates/seminar/archiv/temata.html

@ -7,17 +7,13 @@
{% endblock %}{% endblock%} {% endblock %}{% endblock%}
</h1> </h1>
{% for tema in object_list %} {% for rocnik, temata in rocniky.items %}
{% with tema.cislo_zadani.rocnik.rocnik as rocnik %} <h2>Ročník {{ rocnik }}</h2>
{% ifchanged rocnik %} <ul>
{% if not forloop.first %}</ul>{% endif %} {% for tema in temata %}
<h2>{{ rocnik }}. ročník</h2> <li><a href="{{ tema.verejne_utl }}"> {{ tema.kod_v_rocniku }}: {{ tema.nazev }} </a></li>
<ul> {% endfor %}
{% endifchanged %} </ul>
<li>
<a href="{{ tema.verejne_url }}">{{ tema.kod_v_rocniku }}: {{ tema.nazev }}</a>
{% endwith %}
{% endfor %} {% endfor %}
</ul>
{% endblock content %} {% endblock content %}

89
seminar/templates/seminar/edit.html

@ -15,59 +15,77 @@
<form action="{% url 'seminar_resitel_edit' %}" method="post"> <form action="{% url 'seminar_resitel_edit' %}" method="post">
{% csrf_token %} {% csrf_token %}
{{form.non_field_errors}} {{form.non_field_errors}}
<ul class="form">
<li> <hr>
Přihlašovací údaje
</li><li> <h4>
Přihlašovací údaje
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.username %} {% include "seminar/prihlaska_field.html" with field=form.username %}
</li><li> </table>
<hr>
<h4>
Osobní údaje Osobní údaje
</li><li> </h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.jmeno %} {% include "seminar/prihlaska_field.html" with field=form.jmeno %}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.prijmeni %} {% include "seminar/prihlaska_field.html" with field=form.prijmeni %}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.pohlavi_muz%} {% include "seminar/prihlaska_field.html" with field=form.pohlavi_muz%}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.email %} {% include "seminar/prihlaska_field.html" with field=form.email %}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.telefon %} {% include "seminar/prihlaska_field.html" with field=form.telefon %}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.datum_narozeni %} {% include "seminar/prihlaska_field.html" with field=form.datum_narozeni %}
</li><li> </table>
<hr> <hr>
Bydliště
</li><li> <h4>
Bydliště
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.ulice %} {% include "seminar/prihlaska_field.html" with field=form.ulice %}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.mesto %} {% include "seminar/prihlaska_field.html" with field=form.mesto %}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.psc %} {% include "seminar/prihlaska_field.html" with field=form.psc %}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.stat %} {% include "seminar/prihlaska_field.html" with field=form.stat %}
</li> {% include "seminar/prihlaska_field.html" with field=form.stat_text id="id_li_stat_text"%}
<li id="id_li_stat_text"> </table>
{% include "seminar/prihlaska_field.html" with field=form.stat_text %}
</li><li>
<hr> <hr>
<h4>
Škola
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.skola %} {% include "seminar/prihlaska_field.html" with field=form.skola %}
</li><li> <tr><td colspan="2" ><button id="id_skola_text_button" type="button">Škola není v seznamu</button></td></tr>
<button id="id_skola_text_button" type="button">Škola není v seznamu</button> <tr><td id="id_li_skola_vypln" colspan="2">Vyplň prosím celý název a adresu školy.</td></tr>
</li> {% include "seminar/prihlaska_field.html" with field=form.skola_nazev id="id_li_skola_nazev" %}
<li id="id_li_skola_nazev"> {% include "seminar/prihlaska_field.html" with field=form.skola_adresa id="id_li_skola_adresa" %}
Vyplň prosím celý název a adresu školy.<br>
{% include "seminar/prihlaska_field.html" with field=form.skola_nazev %}
</li>
<li id="id_li_skola_adresa">
{% include "seminar/prihlaska_field.html" with field=form.skola_adresa %}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.rok_maturity %} {% include "seminar/prihlaska_field.html" with field=form.rok_maturity %}
</li><li> </table>
<hr>
<h4>
Pošta
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.zasilat %} {% include "seminar/prihlaska_field.html" with field=form.zasilat %}
</li><li> </table>
<hr>
<h4>
Zasílání propagačních materiálů
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.spam %} {% include "seminar/prihlaska_field.html" with field=form.spam %}
</li> </table>
</ul>
<hr>
<input type="submit" value="Změnit"> <input type="submit" value="Změnit">
</form> </form>
<script> <script>
@ -75,4 +93,3 @@ $("#id_stat").on("change",addrCountryChanged);
$("#id_skola_text_button").on("click",schoolNotInList); $("#id_skola_text_button").on("click",schoolNotInList);
</script> </script>
{% endblock %} {% endblock %}

7
seminar/templates/seminar/login.html

@ -10,9 +10,9 @@
</h1> </h1>
<form action="{% url 'login' %}" method="post"> <form action="{% url 'login' %}" method="post">
{% csrf_token %} {% csrf_token %}
<ul class="form"> <table class="form">
{{ form.as_ul }} {{ form.as_table }}
</ul> </table>
{# Django si posílá jméno další stránky jako obsah formuláře a výchozí hodnota (mi přišlo, že) nejde změnit... #} {# Django si posílá jméno další stránky jako obsah formuláře a výchozí hodnota (mi přišlo, že) nejde změnit... #}
<input type="hidden" name='next' value="{{ next }}"> <input type="hidden" name='next' value="{{ next }}">
<input type="submit" value="Přihlásit"> <input type="submit" value="Přihlásit">
@ -23,4 +23,3 @@
{% endblock %} {% endblock %}

168
seminar/templates/seminar/prihlaska.html

@ -14,92 +14,93 @@
{% endblock %}{% endblock %} {% endblock %}{% endblock %}
</h1> </h1>
<form action="{% url 'seminar_prihlaska' %}" method="post"> <form action="{% url 'seminar_prihlaska' %}" method="post">
{% csrf_token %} {% csrf_token %}
{{form.non_field_errors}} {{form.non_field_errors}}
<ul class="form">
<li>
Přihlašovací údaje <hr>
</li> <h4>
<li> Přihlašovací údaje
{% include "seminar/prihlaska_field.html" with field=form.username %} </h4>
</li> <table class="form">
<li> {% include "seminar/prihlaska_field.html" with field=form.username %}
{% include "seminar/prihlaska_field.html" with field=form.password %} {% include "seminar/prihlaska_field.html" with field=form.password %}
</li> {% include "seminar/prihlaska_field.html" with field=form.password_check %}
<li> </table>
{% include "seminar/prihlaska_field.html" with field=form.password_check %}
</li> <hr>
<li>
Osobní údaje <h4>
</li> Osobní údaje
<li> </h4>
{% include "seminar/prihlaska_field.html" with field=form.jmeno %} <table class="form">
</li> {% include "seminar/prihlaska_field.html" with field=form.jmeno %}
<li> {% include "seminar/prihlaska_field.html" with field=form.prijmeni %}
{% include "seminar/prihlaska_field.html" with field=form.prijmeni %} {% include "seminar/prihlaska_field.html" with field=form.pohlavi_muz%}
</li> {% include "seminar/prihlaska_field.html" with field=form.email %}
<li> {% include "seminar/prihlaska_field.html" with field=form.telefon %}
{% include "seminar/prihlaska_field.html" with field=form.pohlavi_muz%} {% include "seminar/prihlaska_field.html" with field=form.datum_narozeni %}
</li> </table>
<li>
{% include "seminar/prihlaska_field.html" with field=form.email %} <hr>
</li>
<li> <h4>
{% include "seminar/prihlaska_field.html" with field=form.telefon %} Bydliště
</li> </h4>
<li> <table class="form">
{% include "seminar/prihlaska_field.html" with field=form.datum_narozeni %} {% include "seminar/prihlaska_field.html" with field=form.ulice %}
</li> {% include "seminar/prihlaska_field.html" with field=form.mesto %}
<li> {% include "seminar/prihlaska_field.html" with field=form.psc %}
<hr> {% include "seminar/prihlaska_field.html" with field=form.stat %}
Bydliště {% include "seminar/prihlaska_field.html" with field=form.stat_text id="id_li_stat_text"%}
</li> </table>
<li>
{% include "seminar/prihlaska_field.html" with field=form.ulice %} <hr>
</li>
<li> <h4>
{% include "seminar/prihlaska_field.html" with field=form.mesto %} Škola
</li> </h4>
<li> <table class="form">
{% include "seminar/prihlaska_field.html" with field=form.psc %} {% include "seminar/prihlaska_field.html" with field=form.skola %}
</li> <tr><td colspan="2" ><button id="id_skola_text_button" type="button">Škola není v seznamu</button></td></tr>
<li> <tr><td id="id_li_skola_vypln" colspan="2">Vyplň prosím celý název a adresu školy.</td></tr>
{% include "seminar/prihlaska_field.html" with field=form.stat %} {% include "seminar/prihlaska_field.html" with field=form.skola_nazev id="id_li_skola_nazev" %}
</li> {% include "seminar/prihlaska_field.html" with field=form.skola_adresa id="id_li_skola_adresa" %}
<li id="id_li_stat_text"> {% include "seminar/prihlaska_field.html" with field=form.rok_maturity %}
{% include "seminar/prihlaska_field.html" with field=form.stat_text %} </table>
</li>
<hr>
<li>
<hr> <h4>
{% include "seminar/prihlaska_field.html" with field=form.skola %} Pošta
</li> </h4>
<li> <table class="form">
<button id="id_skola_text_button" type="button">Škola není v seznamu</button> {% include "seminar/prihlaska_field.html" with field=form.zasilat %}
</li> </table>
<li id="id_li_skola_nazev"> <hr>
Vyplň prosím celý název a adresu školy.<br>
{% include "seminar/prihlaska_field.html" with field=form.skola_nazev %} <h4>
</li> GDPR
<li id="id_li_skola_adresa"> </h4>
{% include "seminar/prihlaska_field.html" with field=form.skola_adresa %} {% include "seminar/gdpr.html" %}
</li> <table class="form">
<li> {% include "seminar/prihlaska_field.html" with field=form.gdpr %}
{% include "seminar/prihlaska_field.html" with field=form.rok_maturity %} </table>
</li>
<li> <hr>
{% include "seminar/prihlaska_field.html" with field=form.zasilat %}
</li> <h4>
<li> Zasílání propagačních materiálů
{% include "seminar/gdpr.html" %} </h4>
{% include "seminar/prihlaska_field.html" with field=form.gdpr %} <table class="form">
</li> {% include "seminar/prihlaska_field.html" with field=form.spam %}
<li> </table>
{% include "seminar/prihlaska_field.html" with field=form.spam %}
</li>
</ul>
<hr>
<input type="submit" value="Odeslat"> <input type="submit" value="Odeslat">
</form> </form>
<script> <script>
@ -109,4 +110,3 @@ $("#id_skola_text_button").on("click",schoolNotInList);
{% endblock %} {% endblock %}

27
seminar/templates/seminar/prihlaska_field.html

@ -1,4 +1,23 @@
<label class="field-label{% if field.field.required %} field-required{% endif %}" for="{{ field.id_for_label }}">{{ field.label }}:</label>
{{field}} <tr id="{{ id }}" >
{% if field.help_text %}<span class="field-helptext">{{ field.help_text|safe }}</span>{% endif %} <td>
{% if field.errors %}<span class="field-error">{{ field.errors }}</span>{% endif %} <label class="field-label{% if field.field.required %} field-required{% endif %}" for="{{ field.id_for_label }}">
{{ field.label }}:
</label>
</td>
<td>
{{ field }}
</td>
</tr>
{% if field.help_text %}
<tr>
<td colspan="2"><span class="field-helptext">{{ field.help_text|safe }}</span></td>
</tr>
{% endif %}
{% if field.errors %}
<tr>
<td colspan="2"><span class="field-error">{{ field.errors }}</span></td>
</tr>
{% endif %}

5
seminar/urls.py

@ -34,11 +34,6 @@ urlpatterns = [
views.SoustredeniListView.as_view(), views.SoustredeniListView.as_view(),
name='seminar_seznam_soustredeni' name='seminar_seznam_soustredeni'
), ),
path(
'soustredeni/probehlo/<int:soustredeni>/',
views.SoustredeniView.as_view(),
name='seminar_soustredeni'
),
path( path(
'soustredeni/<int:soustredeni>/seznam_ucastniku', 'soustredeni/<int:soustredeni>/seznam_ucastniku',
staff_member_required(views.SoustredeniUcastniciView.as_view()), staff_member_required(views.SoustredeniUcastniciView.as_view()),

14
seminar/views/views_all.py

@ -27,6 +27,7 @@ import seminar.forms as f
from datetime import timedelta, date, datetime from datetime import timedelta, date, datetime
from django.utils import timezone from django.utils import timezone
from itertools import groupby from itertools import groupby
from collections import OrderedDict
import tempfile import tempfile
import subprocess import subprocess
import shutil import shutil
@ -777,7 +778,14 @@ class CisloView(generic.DetailView):
class ArchivTemataView(generic.ListView): class ArchivTemataView(generic.ListView):
model = Problem model = Problem
template_name = 'seminar/archiv/temata.html' template_name = 'seminar/archiv/temata.html'
queryset = Tema.objects.filter(stav=Problem.STAV_ZADANY).select_related('cislo_zadani__rocnik').order_by('-cislo_zadani__rocnik__rocnik', 'kod') queryset = Tema.objects.filter(stav=Problem.STAV_ZADANY).select_related('rocnik').order_by('rocnik', 'kod')
def get_context_data(self, *args, **kwargs):
ctx = super().get_context_data(*args, **kwargs)
ctx['rocniky'] = OrderedDict()
for rocnik, temata in groupby(ctx['object_list'], lambda tema: tema.rocnik):
ctx['rocniky'][rocnik] = list(temata)
return ctx
### Generovani vysledkovky ### Generovani vysledkovky
@ -913,10 +921,6 @@ class SoustredeniListView(generic.ListView):
model = Soustredeni model = Soustredeni
template_name = 'seminar/soustredeni/seznam_soustredeni.html' template_name = 'seminar/soustredeni/seznam_soustredeni.html'
class SoustredeniView(generic.DetailView):
model = Soustredeni
template_name = 'seminar/archiv/soustredeni.html'
def soustredeniObalkyView(request,soustredeni): def soustredeniObalkyView(request,soustredeni):
soustredeni = get_object_or_404(Soustredeni,id = soustredeni) soustredeni = get_object_or_404(Soustredeni,id = soustredeni)
return obalkyView(request,soustredeni.ucastnici.all()) return obalkyView(request,soustredeni.ucastnici.all())

Loading…
Cancel
Save