Pavel "LEdoian" Turinsky
4 years ago
32 changed files with 482 additions and 99 deletions
@ -0,0 +1,187 @@ |
|||||
|
Jak zvládnout migrace na nový model: |
||||
|
|
||||
|
- V mojí verzi databáze mají úlohy-Problémy typ "b'uloha'" |
||||
|
|
||||
|
|
||||
|
Log migrace na nový model: |
||||
|
|
||||
|
Operations to perform: |
||||
|
Apply all migrations: admin, auth, contenttypes, django_comments, flatpages, fluent_comments, galerie, korektury, prednasky, reversion, seminar, sessions, sites, sitetree, taggit, threadedcomments |
||||
|
Running migrations: |
||||
|
Applying admin.0003_logentry_add_action_flag_choices... OK |
||||
|
Applying auth.0009_alter_user_last_name_max_length... OK |
||||
|
Applying auth.0010_alter_group_name_max_length... OK |
||||
|
Applying auth.0011_update_proxy_permissions... OK |
||||
|
Applying galerie.0008_auto_20190430_2340... OK |
||||
|
Applying galerie.0009_auto_20190610_2358... OK |
||||
|
Applying galerie.0010_auto_20200819_0947... OK |
||||
|
Applying korektury.0016_auto_20190430_2340... OK |
||||
|
Applying korektury.0017_auto_20190610_2358... OK |
||||
|
Applying prednasky.0011_auto_20190430_2340... OK |
||||
|
Applying prednasky.0012_auto_20190610_2358... OK |
||||
|
Applying seminar.0049_auto_20190430_2354... OK |
||||
|
Applying seminar.0050_auto_20190510_2228... OK |
||||
|
Applying seminar.0051_resitel_to_osoba... OK |
||||
|
Applying seminar.0052_user_to_organizator... OK |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_do received a naive datetime (2004-12-31 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_od received a naive datetime (1998-01-01 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_do received a naive datetime (2017-12-31 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_od received a naive datetime (2017-01-01 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_do received a naive datetime (2014-12-31 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_od received a naive datetime (2011-01-01 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_do received a naive datetime (2013-12-31 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_od received a naive datetime (2004-01-01 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_od received a naive datetime (2013-01-01 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_do received a naive datetime (2012-12-31 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_od received a naive datetime (2007-01-01 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_do received a naive datetime (2011-12-31 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_od received a naive datetime (2009-01-01 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_do received a naive datetime (2009-12-31 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_do received a naive datetime (2008-12-31 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_od received a naive datetime (2005-01-01 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_do received a naive datetime (2015-12-31 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_od received a naive datetime (2001-01-01 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_od received a naive datetime (2010-01-01 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_od received a naive datetime (2008-01-01 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_do received a naive datetime (2006-12-31 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_od received a naive datetime (2002-01-01 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_do received a naive datetime (2005-12-31 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_od received a naive datetime (1999-01-01 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_od received a naive datetime (2003-01-01 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_od received a naive datetime (2000-01-01 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_do received a naive datetime (2002-12-31 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_do received a naive datetime (2001-12-31 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_od received a naive datetime (1996-01-01 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_do received a naive datetime (2000-12-31 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_do received a naive datetime (1999-12-31 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_do received a naive datetime (1996-12-31 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_od received a naive datetime (1994-01-01 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_od received a naive datetime (2012-01-01 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_do received a naive datetime (2016-12-31 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_do received a naive datetime (2018-12-31 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_od received a naive datetime (2014-01-01 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_do received a naive datetime (2019-12-31 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_od received a naive datetime (2006-01-01 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_od received a naive datetime (1995-01-01 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_do received a naive datetime (2007-12-31 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_od received a naive datetime (2015-01-01 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_od received a naive datetime (2016-01-01 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_od received a naive datetime (2018-01-01 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_od received a naive datetime (2019-01-01 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
/aux/akce/mam/www/mamweb-test/env/lib/python3.7/site-packages/django/db/models/fields/__init__.py:1427: RuntimeWarning: DateTimeField Organizator.organizuje_od received a naive datetime (2020-01-01 00:00:00) while time zone support is active. |
||||
|
RuntimeWarning) |
||||
|
Applying seminar.0053_organizator_organizuje_od_do... OK |
||||
|
Applying seminar.0055_smazat_nemigrovane_zastarale_veci... OK |
||||
|
Applying seminar.0056_vrcholy_pro_rocniky_a_cisla... OK |
||||
|
Applying seminar.0057_reseni_to_reseni_hodnoceni...!!!!!!!!!!!!!!! |
||||
|
31397 Reseni object (31397) |
||||
|
!!!!!!!!!!!!!!! |
||||
|
!!!!!!!!!!!!!!! |
||||
|
31396 Reseni object (31396) |
||||
|
!!!!!!!!!!!!!!! |
||||
|
!!!!!!!!!!!!!!! |
||||
|
31395 Reseni object (31395) |
||||
|
!!!!!!!!!!!!!!! |
||||
|
!!!!!!!!!!!!!!! |
||||
|
31394 Reseni object (31394) |
||||
|
!!!!!!!!!!!!!!! |
||||
|
!!!!!!!!!!!!!!! |
||||
|
31393 Reseni object (31393) |
||||
|
!!!!!!!!!!!!!!! |
||||
|
OK |
||||
|
Applying seminar.0058_problem_to_uloha_tema_clanek... OK |
||||
|
Applying seminar.fix_0058... OK |
||||
|
Applying seminar.0059_vytvorit_pohadkanode... OK |
||||
|
Applying seminar.0060_spoj_stromy... OK |
||||
|
Applying seminar.0061_kill_frankenstein... OK |
||||
|
Applying seminar.0062_redukce_modelu_pohadky... OK |
||||
|
Applying seminar.0063_procisteni_migraci... OK |
||||
|
Applying seminar.0064_auto_20190610_2358... OK |
||||
|
Applying seminar.0065_treenode_polymorphic_ctype... OK |
||||
|
Applying seminar.0066_problem_polymorphic_ctype... OK |
||||
|
Applying seminar.0067_auto_20190814_0805... OK |
||||
|
Applying seminar.0068_treenode_nazev... OK |
||||
|
Applying seminar.0069_auto_20191120_2115... OK |
||||
|
Applying seminar.0070_auto_20191120_2357... OK |
||||
|
Applying seminar.0071_remove_nastaveni_aktualni_rocnik... OK |
||||
|
Applying seminar.0072_auto_20191204_2257... OK |
||||
|
Applying seminar.0073_copy_osoba_email_to_user_email... OK |
||||
|
Applying seminar.0074_auto_20200228_1401... OK |
||||
|
Applying seminar.0075_auto_20200228_2010... OK |
||||
|
Applying seminar.0076_auto_20200228_2013... OK |
||||
|
Applying seminar.0077_auto_20200318_2146... OK |
||||
|
Applying seminar.0078_otistenereseninode... OK |
||||
|
Applying seminar.0079_clanek_resitelsky... OK |
||||
|
Applying seminar.0080_zruseni_claneknode_a_konferanode... OK |
||||
|
Applying seminar.0081_auto_20200408_2221... OK |
||||
|
Applying seminar.0082_auto_20200506_1951... OK |
||||
|
Applying seminar.0083_auto_20200506_1952... OK |
||||
|
WARNING 2020-08-20 00:49:07,941 0084_clanek_cislo: Více než jedno řešení pro článek Clanek object (2215) |
||||
|
WARNING 2020-08-20 00:49:07,953 0084_clanek_cislo: Více než jedno řešení pro článek Clanek object (2221) |
||||
|
WARNING 2020-08-20 00:49:07,959 0084_clanek_cislo: Více než jedno řešení pro článek Clanek object (2212) |
||||
|
WARNING 2020-08-20 00:49:07,965 0084_clanek_cislo: Více než jedno řešení pro článek Clanek object (1955) |
||||
|
WARNING 2020-08-20 00:49:07,968 0084_clanek_cislo: Více než jedno řešení pro článek Clanek object (2027) |
||||
|
WARNING 2020-08-20 00:49:07,971 0084_clanek_cislo: Více než jedno řešení pro článek Clanek object (1981) |
||||
|
WARNING 2020-08-20 00:49:07,974 0084_clanek_cislo: Více než jedno řešení pro článek Clanek object (1970) |
||||
|
WARNING 2020-08-20 00:49:07,978 0084_clanek_cislo: Více než jedno řešení pro článek Clanek object (2001) |
||||
|
WARNING 2020-08-20 00:49:07,981 0084_clanek_cislo: Více než jedno řešení pro článek Clanek object (2004) |
||||
|
WARNING 2020-08-20 00:49:07,984 0084_clanek_cislo: Více než jedno řešení pro článek Clanek object (1941) |
||||
|
WARNING 2020-08-20 00:49:07,990 0084_clanek_cislo: Více než jedno řešení pro článek Clanek object (2024) |
||||
|
WARNING 2020-08-20 00:49:07,993 0084_clanek_cislo: Více než jedno řešení pro článek Clanek object (2031) |
||||
|
WARNING 2020-08-20 00:49:07,997 0084_clanek_cislo: Více než jedno řešení pro článek Clanek object (2211) |
||||
|
WARNING 2020-08-20 00:49:08,005 0084_clanek_cislo: Více než jedno řešení pro článek Clanek object (2073) |
||||
|
WARNING 2020-08-20 00:49:08,017 0084_clanek_cislo: Více než jedno řešení pro článek Clanek object (2018) |
||||
|
WARNING 2020-08-20 00:49:08,022 0084_clanek_cislo: Více než jedno řešení pro článek Clanek object (2222) |
||||
|
WARNING 2020-08-20 00:49:08,028 0084_clanek_cislo: Více než jedno řešení pro článek Clanek object (1953) |
||||
|
WARNING 2020-08-20 00:49:08,034 0084_clanek_cislo: Více než jedno řešení pro článek Clanek object (2026) |
||||
|
Applying seminar.0084_clanek_cislo... OK |
||||
|
Applying seminar.0085_nepovinna_prezdivka... OK |
||||
|
Applying seminar.0086_auto_20200819_0959... OK |
||||
|
Applying sitetree.0001_initial... OK |
||||
|
Applying taggit.0003_taggeditem_add_unique_index... OK |
||||
|
|
@ -0,0 +1,18 @@ |
|||||
|
# Generated by Django 2.2.15 on 2020-08-19 07:47 |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('galerie', '0009_auto_20190610_2358'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.AlterField( |
||||
|
model_name='galerie', |
||||
|
name='poradi', |
||||
|
field=models.IntegerField(blank=True, default=0, verbose_name='Pořadí'), |
||||
|
), |
||||
|
] |
@ -0,0 +1,13 @@ |
|||||
|
{% with "/korektury" as cesta %} |
||||
|
|
||||
|
<div id='submenu'> |
||||
|
<ul> |
||||
|
<li class="{% if selected == "aktualni" %}selected{% endif %}"><a href="{{cesta}}/">Aktuální</a> |
||||
|
<li class="{% if selected == "zastarale" %}selected{% endif %}"><a href="{{cesta}}/zastarale/">Zastaralé</a> |
||||
|
<li class="{% if selected == "help" %}selected{% endif %}"><a href="{{cesta}}/help/">Nápověda</a> |
||||
|
</ul> |
||||
|
</div> |
||||
|
|
||||
|
{% endwith %} |
||||
|
|
||||
|
|
@ -0,0 +1,17 @@ |
|||||
|
# Generated by Django 2.2.15 on 2020-08-19 07:59 |
||||
|
|
||||
|
from django.db import migrations |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('seminar', '0085_nepovinna_prezdivka'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.AlterModelOptions( |
||||
|
name='organizator', |
||||
|
options={'ordering': ['-organizuje_do', 'osoba__jmeno', 'osoba__prijmeni'], 'verbose_name': 'Organizátor', 'verbose_name_plural': 'Organizátoři'}, |
||||
|
), |
||||
|
] |
@ -0,0 +1,49 @@ |
|||||
|
# Generated by Django 2.2.16 on 2020-09-04 12:06 |
||||
|
|
||||
|
from django.db import migrations |
||||
|
from logging import getLogger |
||||
|
|
||||
|
log = getLogger(__name__) |
||||
|
|
||||
|
# Oprava migrací 0065 a 0066, kde jsem špatně pochopil django-polymorphic |
||||
|
|
||||
|
# Pomocná funkce -- děláme to samé pro obě polymorfní hierarchie |
||||
|
def fix_ctypes(parent: str, children, apps, schema_editor): |
||||
|
Parent = apps.get_model('seminar', parent) |
||||
|
ContentType = apps.get_model('contenttypes', 'ContentType') |
||||
|
|
||||
|
# Nejdřív všechno smažeme: |
||||
|
Parent.objects.update(polymorphic_ctype=None) |
||||
|
|
||||
|
# Opravíme děti |
||||
|
for clsname in children: |
||||
|
Model = apps.get_model('seminar', clsname) |
||||
|
ct = ContentType.objects.get_for_model(Model) |
||||
|
Model.objects.update(polymorphic_ctype=ct) |
||||
|
|
||||
|
|
||||
|
# Ostatní instance mají mít explicitně content type pro rodiče |
||||
|
new_ct = ContentType.objects.get_for_model(Parent) |
||||
|
for obj in Parent.objects.filter(polymorphic_ctype__isnull=True): |
||||
|
log.warn(f"{parent} \"{obj}\" neměl content type -- nejspíš to je instance přímo {parent}!") |
||||
|
obj.polymorphic_ctype=new_ct |
||||
|
obj.save() |
||||
|
|
||||
|
def fix_treenode(apps, schema_editor): |
||||
|
children = ['RocnikNode', 'CisloNode', 'MezicisloNode', 'TemaVCisleNode', |
||||
|
'OrgTextNode', 'UlohaZadaniNode', 'UlohaVzorakNode', 'PohadkaNode', |
||||
|
'TextNode', 'CastNode', 'ReseniNode'] |
||||
|
fix_ctypes("TreeNode", children, apps, schema_editor) |
||||
|
|
||||
|
def fix_problem(apps, schema_editor): |
||||
|
children = ['Tema', 'Clanek', 'Uloha'] # FIXME: Konfera z nějakého důvodu tenhle field vůbec nemá, asi je to špatně. |
||||
|
fix_ctypes("Problem", children, apps, schema_editor) |
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
dependencies = [ |
||||
|
('seminar', '0086_auto_20200819_0959'), |
||||
|
] |
||||
|
operations = [ |
||||
|
migrations.RunPython(fix_treenode, migrations.RunPython.noop), |
||||
|
migrations.RunPython(fix_problem, migrations.RunPython.noop), |
||||
|
] |
@ -0,0 +1,14 @@ |
|||||
|
from django.db import migrations |
||||
|
|
||||
|
sql = "update seminar_problemy set typ = 'uloha' where typ like 'b_uloha_';" |
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('seminar', '0058_problem_to_uloha_tema_clanek'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.RunSQL(sql, sql), |
||||
|
] |
||||
|
|
Loading…
Reference in new issue