From c1938c8ff7f2641d6994657de85f1c6ddaa159c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 5 Nov 2024 19:56:07 +0100 Subject: [PATCH] =?UTF-8?q?Odst=C5=99el=20funkc=C3=AD=20pro=20migrace?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/migrations/0001_initial.py | 5 +++-- .../0001_squashed_0098_auto_20210906_0305.py | 21 +++++++++++-------- seminar/migrations/0002_add_body_views.py | 6 +----- .../migrations/0028_add_body_celkem_views.py | 6 +----- .../migrations/0029_fix_body_celkem_views.py | 6 +----- seminar/migrations/0031_cislo_pdf.py | 4 ++-- .../migrations/0032_cislo_pdf_blank_typos.py | 5 +++-- seminar/migrations/0041_konfery.py | 7 ++++--- seminar/migrations/0042_auto_20161005_0847.py | 6 +++--- seminar/migrations/0081_auto_20200408_2221.py | 5 +++-- seminar/migrations/0082_auto_20200506_1951.py | 4 ++-- seminar/migrations/0100_auto_20211129_2354.py | 4 ++-- seminar/migrations/0103_deadline.py | 12 +++++------ .../0105_odstraneni_deadlinu_cisla.py | 2 +- .../0106_remove_cislo_verejna_vysledkovka.py | 2 +- seminar/models.py | 12 +++++++++++ seminar/models/__init__.py | 18 ---------------- 17 files changed, 57 insertions(+), 68 deletions(-) create mode 100644 seminar/models.py delete mode 100644 seminar/models/__init__.py diff --git a/seminar/migrations/0001_initial.py b/seminar/migrations/0001_initial.py index cd36a7dc..9b7a35a5 100644 --- a/seminar/migrations/0001_initial.py +++ b/seminar/migrations/0001_initial.py @@ -2,10 +2,11 @@ from __future__ import unicode_literals from django.db import models, migrations import django_countries.fields -import seminar.models import django.utils.timezone from django.conf import settings +from odevzdavatko.models import generate_filename + class Migration(migrations.Migration): @@ -75,7 +76,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(serialize=False, primary_key=True)), ('timestamp', models.DateTimeField(auto_now=True, verbose_name='vytvo\u0159eno')), - ('soubor', models.FileField(upload_to=seminar.models.generate_filename, verbose_name='soubor')), + ('soubor', models.FileField(upload_to=generate_filename, verbose_name='soubor')), ('poznamka', models.TextField(help_text='Neve\u0159ejn\xe1 pozn\xe1mka k p\u0159\xedloze \u0159e\u0161en\xed (plain text), nap\u0159. o p\u016fvodu', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True)), ], options={ diff --git a/seminar/migrations/0001_squashed_0098_auto_20210906_0305.py b/seminar/migrations/0001_squashed_0098_auto_20210906_0305.py index a95f9c1b..f9eea4fe 100644 --- a/seminar/migrations/0001_squashed_0098_auto_20210906_0305.py +++ b/seminar/migrations/0001_squashed_0098_auto_20210906_0305.py @@ -7,9 +7,12 @@ import django.db.models.deletion import django.utils.timezone import django_countries.fields import imagekit.models.fields -import seminar.models import taggit.managers +from soustredeni.models import generate_filename_konfera +from odevzdavatko.models import generate_filename +from tvorba.models import cislo_pdf_filename, cislo_png_filename + from datetime import date from django.db.models import Q from treenode.treelib import get_parent @@ -962,7 +965,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(primary_key=True, serialize=False)), ('timestamp', models.DateTimeField(auto_now=True, verbose_name='vytvořeno')), - ('soubor', models.FileField(upload_to=seminar.models.generate_filename, verbose_name='soubor')), + ('soubor', models.FileField(upload_to=generate_filename, verbose_name='soubor')), ('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka k příloze řešení (plain text), např. o původu', verbose_name='neveřejná poznámka')), ('reseni', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='prilohy', to='seminar.Reseni', verbose_name='řešení')), ], @@ -1284,7 +1287,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='cislo', name='pdf', - field=models.FileField(blank=True, help_text='Pdf čísla, které si mohou řešitelé stáhnout', null=True, upload_to=seminar.models.cislo_pdf_filename, verbose_name='pdf'), + field=models.FileField(blank=True, help_text='Pdf čísla, které si mohou řešitelé stáhnout', null=True, upload_to=cislo_pdf_filename, verbose_name='pdf'), ), migrations.AlterField( model_name='problem', @@ -1361,8 +1364,8 @@ class Migration(migrations.Migration): ('abstrakt', models.TextField(blank=True, help_text='Abstrakt konfery tak, jak byl uveden ve sborníku', verbose_name='abstrakt')), ('org_poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka ke konfeře(plain text)', verbose_name='neveřejná poznámka')), ('typ_prezentace', models.CharField(choices=[(b'veletrh', 'Veletrh (postery)'), (b'prezentace', 'Prezentace (přednáška)')], default=b'veletrh', max_length=16, verbose_name='typ prezentace')), - ('prezentace', models.FileField(help_text='Prezentace nebo fotka posteru', upload_to=seminar.models.generate_filename_konfera, verbose_name='prezentace')), - ('materialy', models.FileField(help_text='Další materiály ke konfeře zabalené do jednoho souboru', upload_to=seminar.models.generate_filename_konfera, verbose_name='materialy')), + ('prezentace', models.FileField(help_text='Prezentace nebo fotka posteru', upload_to=generate_filename_konfera, verbose_name='prezentace')), + ('materialy', models.FileField(help_text='Další materiály ke konfeře zabalené do jednoho souboru', upload_to=generate_filename_konfera, verbose_name='materialy')), ('organizator', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='konfery', to='seminar.Organizator', verbose_name='organizátor')), ('soustredeni', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='konfery', to='seminar.Soustredeni', verbose_name='soustředění')), ], @@ -1400,12 +1403,12 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='konfera', name='materialy', - field=models.FileField(blank=True, help_text='Další materiály ke konfeře zabalené do jednoho souboru', upload_to=seminar.models.generate_filename_konfera, verbose_name='materialy'), + field=models.FileField(blank=True, help_text='Další materiály ke konfeře zabalené do jednoho souboru', upload_to=generate_filename_konfera, verbose_name='materialy'), ), migrations.AlterField( model_name='konfera', name='prezentace', - field=models.FileField(blank=True, help_text='Prezentace nebo fotka posteru', upload_to=seminar.models.generate_filename_konfera, verbose_name='prezentace'), + field=models.FileField(blank=True, help_text='Prezentace nebo fotka posteru', upload_to=generate_filename_konfera, verbose_name='prezentace'), ), migrations.AddField( model_name='konfera', @@ -2648,12 +2651,12 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='cislo', name='pdf', - field=models.FileField(blank=True, help_text='PDF čísla, které si mohou řešitelé stáhnout', null=True, upload_to=seminar.models.cislo_pdf_filename, verbose_name='pdf'), + field=models.FileField(blank=True, help_text='PDF čísla, které si mohou řešitelé stáhnout', null=True, upload_to=cislo_pdf_filename, verbose_name='pdf'), ), migrations.AddField( 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'), + field=models.ImageField(blank=True, help_text='Obrázek titulní strany, generuje se automaticky', null=True, upload_to=cislo_png_filename, verbose_name='Obrázek titulní strany'), ), migrations.AlterField( model_name='treenode', diff --git a/seminar/migrations/0002_add_body_views.py b/seminar/migrations/0002_add_body_views.py index 1ece029e..19851d58 100644 --- a/seminar/migrations/0002_add_body_views.py +++ b/seminar/migrations/0002_add_body_views.py @@ -1,10 +1,6 @@ from __future__ import unicode_literals -from django.db import models, migrations -import django_countries.fields -import seminar.models -import django.utils.timezone -from django.conf import settings +from django.db import migrations CREATE_VIEWS=""" create view seminar_body_za_cislo as diff --git a/seminar/migrations/0028_add_body_celkem_views.py b/seminar/migrations/0028_add_body_celkem_views.py index c26baec2..b4e7fd90 100644 --- a/seminar/migrations/0028_add_body_celkem_views.py +++ b/seminar/migrations/0028_add_body_celkem_views.py @@ -1,10 +1,6 @@ from __future__ import unicode_literals -from django.db import models, migrations -import django_countries.fields -import seminar.models -import django.utils.timezone -from django.conf import settings +from django.db import migrations CREATE_VIEWS=""" drop view seminar_body_k_cislu; diff --git a/seminar/migrations/0029_fix_body_celkem_views.py b/seminar/migrations/0029_fix_body_celkem_views.py index b2b9f24a..8577f3e9 100644 --- a/seminar/migrations/0029_fix_body_celkem_views.py +++ b/seminar/migrations/0029_fix_body_celkem_views.py @@ -1,10 +1,6 @@ from __future__ import unicode_literals -from django.db import models, migrations -import django_countries.fields -import seminar.models -import django.utils.timezone -from django.conf import settings +from django.db import migrations CREATE_VIEWS=""" diff --git a/seminar/migrations/0031_cislo_pdf.py b/seminar/migrations/0031_cislo_pdf.py index b2b65102..8392a581 100644 --- a/seminar/migrations/0031_cislo_pdf.py +++ b/seminar/migrations/0031_cislo_pdf.py @@ -1,7 +1,7 @@ from __future__ import unicode_literals from django.db import models, migrations -import seminar.models +from tvorba.models import cislo_pdf_filename class Migration(migrations.Migration): @@ -14,7 +14,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='cislo', name='pdf', - field=models.FileField(help_text='Pdf \u010d\xedsla, kter\xe9 si mohou \u0159e\u0161itel\xe9 st\xe1hnout', upload_to=seminar.models.cislo_pdf_filename, null=True, verbose_name='pdf'), + field=models.FileField(help_text='Pdf \u010d\xedsla, kter\xe9 si mohou \u0159e\u0161itel\xe9 st\xe1hnout', upload_to=cislo_pdf_filename, null=True, verbose_name='pdf'), preserve_default=True, ), ] diff --git a/seminar/migrations/0032_cislo_pdf_blank_typos.py b/seminar/migrations/0032_cislo_pdf_blank_typos.py index b72ad75d..3d37d347 100644 --- a/seminar/migrations/0032_cislo_pdf_blank_typos.py +++ b/seminar/migrations/0032_cislo_pdf_blank_typos.py @@ -2,7 +2,8 @@ from __future__ import unicode_literals from django.db import models, migrations import django_countries.fields -import seminar.models + +from tvorba.models import cislo_pdf_filename class Migration(migrations.Migration): @@ -25,7 +26,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='cislo', name='pdf', - field=models.FileField(help_text='Pdf \u010d\xedsla, kter\xe9 si mohou \u0159e\u0161itel\xe9 st\xe1hnout', upload_to=seminar.models.cislo_pdf_filename, null=True, verbose_name='pdf', blank=True), + field=models.FileField(help_text='Pdf \u010d\xedsla, kter\xe9 si mohou \u0159e\u0161itel\xe9 st\xe1hnout', upload_to=cislo_pdf_filename, null=True, verbose_name='pdf', blank=True), preserve_default=True, ), migrations.AlterField( diff --git a/seminar/migrations/0041_konfery.py b/seminar/migrations/0041_konfery.py index bb040465..d4941c3b 100644 --- a/seminar/migrations/0041_konfery.py +++ b/seminar/migrations/0041_konfery.py @@ -2,7 +2,8 @@ from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion -import seminar.models + +from soustredeni.models import generate_filename_konfera class Migration(migrations.Migration): @@ -21,8 +22,8 @@ class Migration(migrations.Migration): ('abstrakt', models.TextField(help_text='Abstrakt konfery tak, jak byl uveden ve sborn\xedku', verbose_name='abstrakt', blank=True)), ('org_poznamka', models.TextField(help_text='Neve\u0159ejn\xe1 pozn\xe1mka ke konfe\u0159e(plain text)', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True)), ('typ_prezentace', models.CharField(default=b'veletrh', max_length=16, verbose_name='typ prezentace', choices=[(b'veletrh', 'Veletrh (postery)'), (b'prezentace', 'Prezentace (p\u0159edn\xe1\u0161ka)')])), - ('prezentace', models.FileField(help_text='Prezentace nebo fotka posteru', upload_to=seminar.models.generate_filename_konfera, verbose_name='prezentace')), - ('materialy', models.FileField(help_text='Dal\u0161\xed materi\xe1ly ke konfe\u0159e zabalen\xe9 do jednoho souboru', upload_to=seminar.models.generate_filename_konfera, verbose_name='materialy')), + ('prezentace', models.FileField(help_text='Prezentace nebo fotka posteru', upload_to=generate_filename_konfera, verbose_name='prezentace')), + ('materialy', models.FileField(help_text='Dal\u0161\xed materi\xe1ly ke konfe\u0159e zabalen\xe9 do jednoho souboru', upload_to=generate_filename_konfera, verbose_name='materialy')), ('organizator', models.ForeignKey(related_name='konfery', on_delete=django.db.models.deletion.SET_NULL, verbose_name='organiz\xe1tor', to='seminar.Organizator', null=True)), ], options={ diff --git a/seminar/migrations/0042_auto_20161005_0847.py b/seminar/migrations/0042_auto_20161005_0847.py index e606e325..c06986c3 100644 --- a/seminar/migrations/0042_auto_20161005_0847.py +++ b/seminar/migrations/0042_auto_20161005_0847.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion -import seminar.models +from soustredeni.models import generate_filename_konfera class Migration(migrations.Migration): @@ -15,12 +15,12 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='konfera', name='materialy', - field=models.FileField(help_text='Dal\u0161\xed materi\xe1ly ke konfe\u0159e zabalen\xe9 do jednoho souboru', upload_to=seminar.models.generate_filename_konfera, verbose_name='materialy', blank=True), + field=models.FileField(help_text='Dal\u0161\xed materi\xe1ly ke konfe\u0159e zabalen\xe9 do jednoho souboru', upload_to=generate_filename_konfera, verbose_name='materialy', blank=True), ), migrations.AlterField( model_name='konfera', name='prezentace', - field=models.FileField(help_text='Prezentace nebo fotka posteru', upload_to=seminar.models.generate_filename_konfera, verbose_name='prezentace', blank=True), + field=models.FileField(help_text='Prezentace nebo fotka posteru', upload_to=generate_filename_konfera, verbose_name='prezentace', blank=True), ), migrations.AlterField( model_name='konfera', diff --git a/seminar/migrations/0081_auto_20200408_2221.py b/seminar/migrations/0081_auto_20200408_2221.py index 6cf908bb..0f1edb75 100644 --- a/seminar/migrations/0081_auto_20200408_2221.py +++ b/seminar/migrations/0081_auto_20200408_2221.py @@ -1,7 +1,8 @@ # Generated by Django 2.2.9 on 2020-04-08 20:21 from django.db import migrations, models -import seminar.models + +from tvorba.models import cislo_pdf_filename class Migration(migrations.Migration): @@ -19,6 +20,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='cislo', name='pdf', - field=models.FileField(blank=True, help_text='PDF čísla, které si mohou řešitelé stáhnout', null=True, upload_to=seminar.models.cislo_pdf_filename, verbose_name='pdf'), + field=models.FileField(blank=True, help_text='PDF čísla, které si mohou řešitelé stáhnout', null=True, upload_to=cislo_pdf_filename, verbose_name='pdf'), ), ] diff --git a/seminar/migrations/0082_auto_20200506_1951.py b/seminar/migrations/0082_auto_20200506_1951.py index 3132c434..99ef70e9 100644 --- a/seminar/migrations/0082_auto_20200506_1951.py +++ b/seminar/migrations/0082_auto_20200506_1951.py @@ -1,7 +1,7 @@ # Generated by Django 2.2.12 on 2020-05-06 17:51 from django.db import migrations, models -import seminar.models +from tvorba.models import cislo_png_filename class Migration(migrations.Migration): @@ -14,6 +14,6 @@ class Migration(migrations.Migration): 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'), + field=models.ImageField(blank=True, help_text='Obrázek titulní strany, generuje se automaticky', null=True, upload_to=cislo_png_filename, verbose_name='Obrázek titulní strany'), ), ] diff --git a/seminar/migrations/0100_auto_20211129_2354.py b/seminar/migrations/0100_auto_20211129_2354.py index 87f0b824..dfe92833 100644 --- a/seminar/migrations/0100_auto_20211129_2354.py +++ b/seminar/migrations/0100_auto_20211129_2354.py @@ -2,7 +2,7 @@ from django.db import migrations, models import various.models -import seminar.models +from tvorba.models import cislo_pdf_filename class Migration(migrations.Migration): @@ -15,6 +15,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='cislo', name='pdf', - field=models.FileField(blank=True, help_text='PDF čísla, které si mohou řešitelé stáhnout', null=True, storage=various.models.OverwriteStorage(), upload_to=seminar.models.cislo_pdf_filename, verbose_name='pdf'), + field=models.FileField(blank=True, help_text='PDF čísla, které si mohou řešitelé stáhnout', null=True, storage=various.models.OverwriteStorage(), upload_to=cislo_pdf_filename, verbose_name='pdf'), ), ] diff --git a/seminar/migrations/0103_deadline.py b/seminar/migrations/0103_deadline.py index 78577373..ba24df13 100644 --- a/seminar/migrations/0103_deadline.py +++ b/seminar/migrations/0103_deadline.py @@ -5,7 +5,7 @@ from django.db import migrations, models import django.db.models.deletion from django.utils import timezone -import seminar.models as m +from tvorba.models import Deadline as mDeadline def vytvor_deadliny(apps, schema_editor): @@ -16,7 +16,7 @@ def vytvor_deadliny(apps, schema_editor): if cislo.rocnik.rocnik < 26: Deadline.objects.create( cislo=cislo, - typ=m.Deadline.TYP_CISLA, + typ=mDeadline.TYP_CISLA, deadline=timezone.make_aware(datetime.datetime.combine(datetime.date(1994 + cislo.rocnik.rocnik, 6, int(cislo.poradi[0])), datetime.time.min)), verejna_vysledkovka=cislo.verejna_vysledkovka, ) @@ -33,24 +33,24 @@ def vytvor_deadliny(apps, schema_editor): if cislo.datum_deadline_soustredeni and cislo.datum_deadline_soustredeni == cislo.datum_preddeadline: vytvor_deadline( date=cislo.datum_deadline_soustredeni, - typ=m.Deadline.TYP_PRVNI_A_SOUS + typ=mDeadline.TYP_PRVNI_A_SOUS ) else: if cislo.datum_deadline_soustredeni: vytvor_deadline( date=cislo.datum_deadline_soustredeni, - typ=m.Deadline.TYP_SOUS + typ=mDeadline.TYP_SOUS ) if cislo.datum_preddeadline: vytvor_deadline( date=cislo.datum_preddeadline, - typ=m.Deadline.TYP_PRVNI + typ=mDeadline.TYP_PRVNI ) if cislo.datum_deadline: vytvor_deadline( date=cislo.datum_deadline, - typ=m.Deadline.TYP_CISLA + typ=mDeadline.TYP_CISLA ) diff --git a/seminar/migrations/0105_odstraneni_deadlinu_cisla.py b/seminar/migrations/0105_odstraneni_deadlinu_cisla.py index c3ab3541..262de179 100644 --- a/seminar/migrations/0105_odstraneni_deadlinu_cisla.py +++ b/seminar/migrations/0105_odstraneni_deadlinu_cisla.py @@ -1,7 +1,7 @@ # Generated by Django 3.2.15 on 2022-10-09 10:14 from django.db import migrations -from seminar.models import Deadline +from tvorba.models import Deadline def vrat_deadliny(apps, schema_editor): diff --git a/seminar/migrations/0106_remove_cislo_verejna_vysledkovka.py b/seminar/migrations/0106_remove_cislo_verejna_vysledkovka.py index edccf3c9..e9e652b3 100644 --- a/seminar/migrations/0106_remove_cislo_verejna_vysledkovka.py +++ b/seminar/migrations/0106_remove_cislo_verejna_vysledkovka.py @@ -1,7 +1,7 @@ # Generated by Django 3.2.15 on 2022-10-09 11:04 from django.db import migrations -from seminar.models import Deadline +from tvorba.models import Deadline def vrat_verejnost(apps, schema_editor): diff --git a/seminar/models.py b/seminar/models.py new file mode 100644 index 00000000..8c034a82 --- /dev/null +++ b/seminar/models.py @@ -0,0 +1,12 @@ +# Tento soubor slouží pouze pro shell a podobné. Nikde neimportovat v kódu! +from galerie.models import * +from header_fotky.models import * +from korektury.models import * +from novinky.models import * +from odevzdavatko.models import * +from personalni.models import * +from prednasky.models import * +from soustredeni.models import * +from treenode.models import * +from tvorba.models import * +from various.models import * diff --git a/seminar/models/__init__.py b/seminar/models/__init__.py deleted file mode 100644 index bd660e0c..00000000 --- a/seminar/models/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -from various.models import Nastaveni -from personalni.models import Organizator, Resitel, Skola, Prijemce, Osoba -from soustredeni.models import Soustredeni, Soustredeni_Ucastnici, Soustredeni_Organizatori, Konfera, Konfery_Ucastnici -from novinky.models import Novinky -from odevzdavatko.models import Reseni, PrilohaReseni, Reseni_Resitele, Hodnoceni -from tvorba.models import ZmrazenaVysledkovka, Deadline, Cislo, Rocnik, Pohadka, Tema, Problem, Problemy_Opravovatele, Uloha, Clanek -from treenode.models import UlohaVzorakNode, UlohaZadaniNode, CisloNode, TemaVCisleNode, OrgTextNode, Obrazek, RocnikNode, PohadkaNode, TextNode, MezicisloNode, ReseniNode, CastNode, Text, TreeNode - -# Kvůli migr. 0041 -from soustredeni.models import generate_filename_konfera -# migr. 0001 -from odevzdavatko.models import generate_filename -# migr. 0031, 0032, 0081 -from tvorba.models import cislo_pdf_filename -# migr. 0082 -from tvorba.models import cislo_png_filename -# migr 0100 (hack) -import tvorba.models as tvorba