Odstřel funkcí pro migrace
This commit is contained in:
parent
f5c2e22121
commit
c1938c8ff7
17 changed files with 57 additions and 68 deletions
|
@ -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={
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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="""
|
||||
|
||||
|
|
|
@ -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,
|
||||
),
|
||||
]
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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={
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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'),
|
||||
),
|
||||
]
|
||||
|
|
|
@ -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'),
|
||||
),
|
||||
]
|
||||
|
|
|
@ -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'),
|
||||
),
|
||||
]
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
12
seminar/models.py
Normal file
12
seminar/models.py
Normal file
|
@ -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 *
|
|
@ -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
|
Loading…
Reference in a new issue