Jonas Havelka
2 years ago
10 changed files with 220 additions and 365 deletions
@ -1,109 +1,19 @@ |
|||
{% extends "base.html" %} |
|||
{% load static %} |
|||
|
|||
{% block script %} |
|||
<script src="{% static 'personalni/prihlaska.js' %}"></script> |
|||
{% endblock %} |
|||
|
|||
<!-- |
|||
|
|||
# pro přidání políčka do formuláře je potřeba |
|||
# - mít v modelu tu položku, kterou chci upravovat |
|||
# - přidat do views (prihlaskaView, resitelEditView) |
|||
# - přidat do forms |
|||
# - includovat do html |
|||
|
|||
--> |
|||
|
|||
{% block content %} |
|||
<h1> |
|||
{% block nadpis1a %} |
|||
Změna osobních údajů |
|||
{% endblock %} |
|||
</h1> |
|||
<form action="{% url 'seminar_resitel_edit' %}" method="post"> |
|||
{% csrf_token %} |
|||
{{form.non_field_errors}} |
|||
|
|||
<hr> |
|||
<p><a href="{% url 'reset_password' %}">Změnit heslo</a></p> |
|||
|
|||
<h4> |
|||
Přihlašovací údaje |
|||
</h4> |
|||
<table class="form"> |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.username %} |
|||
</table> |
|||
<p><a href="{% url 'reset_password' %}"> |
|||
Změnit heslo |
|||
</a></p> |
|||
|
|||
<hr> |
|||
|
|||
<h4> |
|||
Osobní údaje |
|||
</h4> |
|||
<table class="form"> |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.jmeno %} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.prezdivka_resitele %} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.prijmeni %} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.pohlavi_muz%} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.email %} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.telefon %} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.datum_narozeni %} |
|||
</table> |
|||
|
|||
<hr> |
|||
|
|||
<h4> |
|||
Bydliště |
|||
</h4> |
|||
<table class="form"> |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.ulice %} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.mesto %} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.psc %} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.stat %} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.stat_text id="id_li_stat_text"%} |
|||
</table> |
|||
|
|||
<hr> |
|||
|
|||
<h4> |
|||
Škola |
|||
</h4> |
|||
<table class="form"> |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.skola %} |
|||
<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 "personalni/udaje/prihlaska_field.html" with field=form.skola_nazev id="id_li_skola_nazev" %} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.skola_adresa id="id_li_skola_adresa" %} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.rok_maturity %} |
|||
</table> |
|||
|
|||
<hr> |
|||
|
|||
<h4> |
|||
Pošta |
|||
</h4> |
|||
<table class="form"> |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.zasilat %} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.zasilat_cislo_emailem %} |
|||
</table> |
|||
|
|||
<hr> |
|||
|
|||
<h4> |
|||
Zasílání propagačních materiálů |
|||
</h4> |
|||
<table class="form"> |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.spam %} |
|||
</table> |
|||
|
|||
<hr> |
|||
|
|||
<form action="{% url 'seminar_resitel_edit' %}" method="post"> |
|||
{% include "personalni/udaje/udaje.html"%} |
|||
<input type="submit" value="Změnit"> |
|||
</form> |
|||
<script> |
|||
$("#id_stat").on("change",addrCountryChanged); |
|||
$("#id_skola_text_button").on("click",schoolNotInList); |
|||
</script> |
|||
|
|||
{% endblock %} |
|||
|
@ -0,0 +1,75 @@ |
|||
{% load static %} |
|||
|
|||
{% block script %} |
|||
<script src="{% static 'personalni/prihlaska.js' %}"></script> |
|||
{% endblock %} |
|||
|
|||
{% csrf_token %} |
|||
{{form.non_field_errors}} |
|||
|
|||
<hr> |
|||
<h4> |
|||
Přihlašovací údaje |
|||
</h4> |
|||
<table class="form"> |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.username %} |
|||
</table> |
|||
|
|||
<hr> |
|||
|
|||
<h4> |
|||
Osobní údaje |
|||
</h4> |
|||
<table class="form"> |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.jmeno %} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.prezdivka_resitele %} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.prijmeni %} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.pohlavi_muz%} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.email %} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.telefon %} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.datum_narozeni %} |
|||
</table> |
|||
|
|||
<hr> |
|||
|
|||
<h4> |
|||
Škola |
|||
</h4> |
|||
<table class="form"> |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.skola %} |
|||
<tr><td colspan="2" ><button id="id_skola_text_button" type="button">Škola není v seznamu</button></td><td>(Prosíme, zkuste ji najít, téměř jistě ji v seznamu máme. Školy se dobře hledají podle příjmení lidí v jejich názvu, podle ulice, případně název ulice <i>mezera</i> město, atd. Nezadávejte slova, která se často zkracují – gymnázium, střední odborná škola, křestní jména…)</td></tr> |
|||
<tr><td id="id_li_skola_vypln" colspan="2">Vyplň prosím celý název a adresu školy.</td></tr> |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.skola_nazev id="id_li_skola_nazev" %} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.skola_adresa id="id_li_skola_adresa" %} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.rok_maturity %} |
|||
</table> |
|||
|
|||
<hr> |
|||
|
|||
<h4> |
|||
Pošta |
|||
</h4> |
|||
<table class="form"> |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.zasilat_cislo_emailem %} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.zasilat_cislo_papirove %} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.spam %} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.zasilat %} |
|||
</table> |
|||
<hr> |
|||
<h4> |
|||
Bydliště (povinné při volbě „domů“) |
|||
</h4> |
|||
<table class="form"> |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.ulice %} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.mesto %} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.psc %} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.stat %} |
|||
{% include "personalni/udaje/prihlaska_field.html" with field=form.stat_text id="id_li_stat_text"%} |
|||
</table> |
|||
|
|||
<hr> |
|||
|
|||
<script> |
|||
$("#id_stat").on("change",addrCountryChanged); |
|||
$("#id_skola_text_button").on("click",schoolNotInList); |
|||
</script> |
@ -0,0 +1,42 @@ |
|||
# Generated by Django 2.2.28 on 2023-03-13 22:02 |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
ZASILAT_DOMU = 'domu' |
|||
ZASILAT_DO_SKOLY = 'do_skoly' |
|||
ZASILAT_NIKAM = 'nikam' |
|||
|
|||
|
|||
def default_zasilat_papirove(apps, schema_editor): |
|||
Resitel = apps.get_model('seminar', 'Resitel') |
|||
|
|||
for resitel in Resitel.objects.all(): |
|||
resitel.zasilat_cislo_papirove = resitel.zasilat != ZASILAT_NIKAM |
|||
if resitel.zasilat == ZASILAT_NIKAM: |
|||
resitel.zasilat = ZASILAT_DOMU if resitel.osoba.ulice else ZASILAT_DO_SKOLY |
|||
resitel.save() |
|||
|
|||
|
|||
def vrat_nikam(apps, schema_editor): |
|||
Resitel = apps.get_model('seminar', 'Resitel') |
|||
|
|||
for resitel in Resitel.objects.all(): |
|||
if not resitel.zasilat_cislo_papirove: |
|||
resitel.zasilat = ZASILAT_NIKAM |
|||
resitel.save() |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('seminar', '0111_nikam2nezasilat_papirove'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AddField( |
|||
model_name='resitel', |
|||
name='zasilat_cislo_papirove', |
|||
field=models.BooleanField(default=True, help_text='True pokud chce řešitel dostávat číslo papírově', verbose_name='zasílat číslo papírově'), |
|||
), |
|||
migrations.RunPython(default_zasilat_papirove, vrat_nikam), |
|||
] |
Loading…
Reference in new issue