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. 14
      seminar/templates/seminar/archiv/temata.html
  8. 85
      seminar/templates/seminar/edit.html
  9. 7
      seminar/templates/seminar/login.html
  10. 122
      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:svg="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"
height="42.333332mm"
viewBox="0 0 25.135418 42.333331"
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
id="defs845" />
<metadata
@ -28,8 +56,10 @@
id="layer1"
transform="matrix(-1.0282842,0,0,1,111.4545,-88.415317)">
<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"
id="path44-3" />
id="path44-3"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccccc" />
</g>
</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:svg="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"
height="42.333332mm"
viewBox="0 0 25.135418 42.333331"
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
id="defs845" />
<metadata
@ -26,10 +54,12 @@
</metadata>
<g
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
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"
id="path44-3" />
id="path44-3"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccccc" />
</g>
</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.core.cache import cache
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.contenttypes.models import ContentType
from django.utils.text import get_valid_filename
from imagekit.models import ImageSpecField, ProcessedImageField
from imagekit.processors import ResizeToFit, Transpose
@ -1304,6 +1305,10 @@ class TreeNode(PolymorphicModel):
def aktualizuj_nazev(self):
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 Meta:
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 = stat_select[stat_select.selectedIndex].value;
if (stat === "other"){
stat_text.style.display="block";
stat_text.style.display="revert";
} else {
stat_text.style.display="none";
$('#id_stat_text').val("");
@ -12,18 +12,22 @@ function addrCountryChanged(){
function hideSchoolTextfields(){
var skola_nazev = document.getElementById('id_li_skola_nazev');
var skola_adresa = document.getElementById('id_li_skola_adresa');
var skola_vypln = document.getElementById('id_li_skola_vypln');
skola_nazev.style.display="none";
skola_adresa.style.display="none";
skola_vypln.style.display="none";
}
function schoolNotInList(){
var skola_nazev = document.getElementById('id_li_skola_nazev');
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)
//var skola_select = $('#id_skola').select2();
//skola_select.val(null).trigger('change');
skola_nazev.style.display="block";
skola_adresa.style.display="block";
skola_vypln.style.display="revert";
skola_nazev.style.display="revert";
skola_adresa.style.display="revert";
}
document.addEventListener("DOMContentLoaded", function(){

14
seminar/templates/seminar/archiv/temata.html

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

85
seminar/templates/seminar/edit.html

@ -15,59 +15,77 @@
<form action="{% url 'seminar_resitel_edit' %}" method="post">
{% csrf_token %}
{{form.non_field_errors}}
<ul class="form">
<li>
<hr>
<h4>
Přihlašovací údaje
</li><li>
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.username %}
</li><li>
</table>
<hr>
<h4>
Osobní údaje
</li><li>
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.jmeno %}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.prijmeni %}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.pohlavi_muz%}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.email %}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.telefon %}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.datum_narozeni %}
</li><li>
</table>
<hr>
<h4>
Bydliště
</li><li>
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.ulice %}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.mesto %}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.psc %}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.stat %}
</li>
<li id="id_li_stat_text">
{% include "seminar/prihlaska_field.html" with field=form.stat_text %}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.stat_text id="id_li_stat_text"%}
</table>
<hr>
<h4>
Škola
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.skola %}
</li><li>
<button id="id_skola_text_button" type="button">Škola není v seznamu</button>
</li>
<li id="id_li_skola_nazev">
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>
<tr><td colspan="2" ><button id="id_skola_text_button" type="button">Škola není v seznamu</button></td></tr>
<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.skola_nazev id="id_li_skola_nazev" %}
{% include "seminar/prihlaska_field.html" with field=form.skola_adresa id="id_li_skola_adresa" %}
{% 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 %}
</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 %}
</li>
</ul>
</table>
<hr>
<input type="submit" value="Změnit">
</form>
<script>
@ -75,4 +93,3 @@ $("#id_stat").on("change",addrCountryChanged);
$("#id_skola_text_button").on("click",schoolNotInList);
</script>
{% endblock %}

7
seminar/templates/seminar/login.html

@ -10,9 +10,9 @@
</h1>
<form action="{% url 'login' %}" method="post">
{% csrf_token %}
<ul class="form">
{{ form.as_ul }}
</ul>
<table class="form">
{{ form.as_table }}
</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... #}
<input type="hidden" name='next' value="{{ next }}">
<input type="submit" value="Přihlásit">
@ -23,4 +23,3 @@
{% endblock %}

122
seminar/templates/seminar/prihlaska.html

@ -14,92 +14,93 @@
{% endblock %}{% endblock %}
</h1>
<form action="{% url 'seminar_prihlaska' %}" method="post">
{% csrf_token %}
{{form.non_field_errors}}
<ul class="form">
<li>
<hr>
<h4>
Přihlašovací údaje
</li>
<li>
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.username %}
</li>
<li>
{% include "seminar/prihlaska_field.html" with field=form.password %}
</li>
<li>
{% include "seminar/prihlaska_field.html" with field=form.password_check %}
</li>
<li>
</table>
<hr>
<h4>
Osobní údaje
</li>
<li>
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.jmeno %}
</li>
<li>
{% include "seminar/prihlaska_field.html" with field=form.prijmeni %}
</li>
<li>
{% include "seminar/prihlaska_field.html" with field=form.pohlavi_muz%}
</li>
<li>
{% include "seminar/prihlaska_field.html" with field=form.email %}
</li>
<li>
{% include "seminar/prihlaska_field.html" with field=form.telefon %}
</li>
<li>
{% include "seminar/prihlaska_field.html" with field=form.datum_narozeni %}
</li>
<li>
<hr>
</table>
<hr>
<h4>
Bydliště
</li>
<li>
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.ulice %}
</li>
<li>
{% include "seminar/prihlaska_field.html" with field=form.mesto %}
</li>
<li>
{% include "seminar/prihlaska_field.html" with field=form.psc %}
</li>
<li>
{% include "seminar/prihlaska_field.html" with field=form.stat %}
</li>
<li id="id_li_stat_text">
{% include "seminar/prihlaska_field.html" with field=form.stat_text %}
</li>
{% include "seminar/prihlaska_field.html" with field=form.stat_text id="id_li_stat_text"%}
</table>
<li>
<hr>
<hr>
<h4>
Škola
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.skola %}
</li>
<li>
<button id="id_skola_text_button" type="button">Škola není v seznamu</button>
</li>
<li id="id_li_skola_nazev">
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>
<tr><td colspan="2" ><button id="id_skola_text_button" type="button">Škola není v seznamu</button></td></tr>
<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.skola_nazev id="id_li_skola_nazev" %}
{% include "seminar/prihlaska_field.html" with field=form.skola_adresa id="id_li_skola_adresa" %}
{% 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 %}
</li>
<li>
</table>
<hr>
<h4>
GDPR
</h4>
{% include "seminar/gdpr.html" %}
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.gdpr %}
</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 %}
</li>
</ul>
</table>
<hr>
<input type="submit" value="Odeslat">
</form>
<script>
@ -109,4 +110,3 @@ $("#id_skola_text_button").on("click",schoolNotInList);
{% 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}}
{% if field.help_text %}<span class="field-helptext">{{ field.help_text|safe }}</span>{% endif %}
{% if field.errors %}<span class="field-error">{{ field.errors }}</span>{% endif %}
<tr id="{{ id }}" >
<td>
<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(),
name='seminar_seznam_soustredeni'
),
path(
'soustredeni/probehlo/<int:soustredeni>/',
views.SoustredeniView.as_view(),
name='seminar_soustredeni'
),
path(
'soustredeni/<int:soustredeni>/seznam_ucastniku',
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 django.utils import timezone
from itertools import groupby
from collections import OrderedDict
import tempfile
import subprocess
import shutil
@ -777,7 +778,14 @@ class CisloView(generic.DetailView):
class ArchivTemataView(generic.ListView):
model = Problem
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
@ -913,10 +921,6 @@ class SoustredeniListView(generic.ListView):
model = Soustredeni
template_name = 'seminar/soustredeni/seznam_soustredeni.html'
class SoustredeniView(generic.DetailView):
model = Soustredeni
template_name = 'seminar/archiv/soustredeni.html'
def soustredeniObalkyView(request,soustredeni):
soustredeni = get_object_or_404(Soustredeni,id = soustredeni)
return obalkyView(request,soustredeni.ucastnici.all())

Loading…
Cancel
Save