Migrace a přejmenování tabulek modelů odevzdávátka
This commit is contained in:
parent
9b3cbb512c
commit
acea74bc6e
3 changed files with 187 additions and 5 deletions
104
odevzdavatko/migrations/0001_initial.py
Normal file
104
odevzdavatko/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
# Generated by Django 2.2.28 on 2023-08-09 17:37
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
import django.utils.timezone
|
||||||
|
import odevzdavatko.models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('tvorba', '0001_initial'),
|
||||||
|
('personalni', '0002_organizator_osoba_prijemce_resitel_skola'),
|
||||||
|
('seminar', '0116_separace_odevzdavatka'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.SeparateDatabaseAndState(
|
||||||
|
state_operations=[
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Hodnoceni',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||||
|
('body', models.DecimalField(blank=True, decimal_places=1, max_digits=8, null=True, verbose_name='body')),
|
||||||
|
('feedback', models.TextField(blank=True, default='', help_text='Zpětná vazba řešiteli (plain text)', verbose_name='zpětná vazba')),
|
||||||
|
('cislo_body', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='hodnoceni', to='tvorba.Cislo', verbose_name='číslo pro body')),
|
||||||
|
('deadline_body', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='hodnoceni', to='tvorba.Deadline', verbose_name='deadline pro body')),
|
||||||
|
('problem', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='hodnoceni', to='tvorba.Problem', verbose_name='problém')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'verbose_name': 'Hodnocení',
|
||||||
|
'verbose_name_plural': 'Hodnocení',
|
||||||
|
'db_table': 'mam_hodnoceni',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Reseni',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||||
|
('cas_doruceni', models.DateTimeField(blank=True, default=django.utils.timezone.now, verbose_name='čas_doručení')),
|
||||||
|
('forma', models.CharField(choices=[('papir', 'Papírové řešení'), ('email', 'Emailem'), ('upload', 'Upload přes web')], default='email', max_length=16, verbose_name='forma řešení')),
|
||||||
|
('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka k řešení (plain text)', verbose_name='neveřejná poznámka')),
|
||||||
|
('zverejneno', models.BooleanField(default=False, help_text='Udává, zda je řešení zveřejněno', verbose_name='řešení zveřejněno')),
|
||||||
|
('problem', models.ManyToManyField(help_text='Problém', through='odevzdavatko.Hodnoceni', to='tvorba.Problem', verbose_name='problém')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'verbose_name': 'Řešení',
|
||||||
|
'verbose_name_plural': 'Řešení',
|
||||||
|
'db_table': 'mam_reseni',
|
||||||
|
'ordering': ['-cas_doruceni'],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Reseni_Resitele',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||||
|
('reseni', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='odevzdavatko.Reseni', verbose_name='řešení')),
|
||||||
|
('resitele', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='personalni.Resitel', verbose_name='řešitel')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'verbose_name': 'Řešení řešitelů',
|
||||||
|
'verbose_name_plural': 'Řešení řešitelů',
|
||||||
|
'db_table': 'mam_reseni_resitele',
|
||||||
|
'ordering': ['reseni', 'resitele'],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='reseni',
|
||||||
|
name='resitele',
|
||||||
|
field=models.ManyToManyField(help_text='Seznam autorů řešení', through='odevzdavatko.Reseni_Resitele', to='personalni.Resitel', verbose_name='autoři řešení'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='reseni',
|
||||||
|
name='text_cely',
|
||||||
|
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='reseni_cely_set', to='seminar.ReseniNode', verbose_name='Plná verze textu řešení'),
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='PrilohaReseni',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||||
|
('vytvoreno', models.DateTimeField(blank=True, default=django.utils.timezone.now, editable=False, verbose_name='vytvořeno')),
|
||||||
|
('soubor', models.FileField(upload_to=odevzdavatko.models.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')),
|
||||||
|
('res_poznamka', models.TextField(blank=True, help_text='Poznámka k příloze řešení, např. co daný soubor obsahuje', verbose_name='poznámka řešitele')),
|
||||||
|
('reseni', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='prilohy', to='odevzdavatko.Reseni', verbose_name='řešení')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'verbose_name': 'Příloha řešení',
|
||||||
|
'verbose_name_plural': 'Přílohy řešení',
|
||||||
|
'db_table': 'mam_priloha_reseni',
|
||||||
|
'ordering': ['reseni', 'vytvoreno'],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='hodnoceni',
|
||||||
|
name='reseni',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='odevzdavatko.Reseni', verbose_name='řešení'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
database_operations=[],
|
||||||
|
),
|
||||||
|
]
|
|
@ -18,7 +18,7 @@ from seminar.models.base import SeminarModelBase
|
||||||
class Reseni(SeminarModelBase):
|
class Reseni(SeminarModelBase):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = 'seminar_reseni'
|
db_table = 'mam_reseni'
|
||||||
verbose_name = 'Řešení'
|
verbose_name = 'Řešení'
|
||||||
verbose_name_plural = 'Řešení'
|
verbose_name_plural = 'Řešení'
|
||||||
#ordering = ['-problem', 'resitele'] # FIXME: Takhle to chceme, ale nefunguje to.
|
#ordering = ['-problem', 'resitele'] # FIXME: Takhle to chceme, ale nefunguje to.
|
||||||
|
@ -48,7 +48,7 @@ class Reseni(SeminarModelBase):
|
||||||
forma = models.CharField('forma řešení', max_length=16, choices=FORMA_CHOICES, blank=False,
|
forma = models.CharField('forma řešení', max_length=16, choices=FORMA_CHOICES, blank=False,
|
||||||
default=FORMA_EMAIL)
|
default=FORMA_EMAIL)
|
||||||
|
|
||||||
text_cely = models.OneToOneField('ReseniNode', verbose_name='Plná verze textu řešení',
|
text_cely = models.OneToOneField("seminar.ReseniNode", verbose_name='Plná verze textu řešení',
|
||||||
blank=True, null=True, related_name="reseni_cely_set",
|
blank=True, null=True, related_name="reseni_cely_set",
|
||||||
on_delete=models.PROTECT)
|
on_delete=models.PROTECT)
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ class Reseni(SeminarModelBase):
|
||||||
|
|
||||||
class Hodnoceni(SeminarModelBase):
|
class Hodnoceni(SeminarModelBase):
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = 'seminar_hodnoceni'
|
db_table = 'mam_hodnoceni'
|
||||||
verbose_name = 'Hodnocení'
|
verbose_name = 'Hodnocení'
|
||||||
verbose_name_plural = 'Hodnocení'
|
verbose_name_plural = 'Hodnocení'
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ def generate_filename(self, filename):
|
||||||
class PrilohaReseni(SeminarModelBase):
|
class PrilohaReseni(SeminarModelBase):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = 'seminar_priloha_reseni'
|
db_table = 'mam_priloha_reseni'
|
||||||
verbose_name = 'Příloha řešení'
|
verbose_name = 'Příloha řešení'
|
||||||
verbose_name_plural = 'Přílohy řešení'
|
verbose_name_plural = 'Přílohy řešení'
|
||||||
ordering = ['reseni', 'vytvoreno']
|
ordering = ['reseni', 'vytvoreno']
|
||||||
|
@ -223,7 +223,7 @@ class PrilohaReseni(SeminarModelBase):
|
||||||
class Reseni_Resitele(models.Model):
|
class Reseni_Resitele(models.Model):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = 'seminar_reseni_resitele'
|
db_table = 'mam_reseni_resitele'
|
||||||
verbose_name = 'Řešení řešitelů'
|
verbose_name = 'Řešení řešitelů'
|
||||||
verbose_name_plural = 'Řešení řešitelů'
|
verbose_name_plural = 'Řešení řešitelů'
|
||||||
ordering = ['reseni', 'resitele']
|
ordering = ['reseni', 'resitele']
|
||||||
|
|
78
seminar/migrations/0116_separace_odevzdavatka.py
Normal file
78
seminar/migrations/0116_separace_odevzdavatka.py
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
# Generated by Django 2.2.28 on 2023-08-09 17:37
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('seminar', '0115_separace_tvorby'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.SeparateDatabaseAndState(
|
||||||
|
state_operations=[
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='prilohareseni',
|
||||||
|
name='reseni',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='reseni',
|
||||||
|
name='problem',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='reseni',
|
||||||
|
name='resitele',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='reseni',
|
||||||
|
name='text_cely',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='reseni_resitele',
|
||||||
|
name='reseni',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='reseni_resitele',
|
||||||
|
name='resitele',
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='reseninode',
|
||||||
|
name='reseni',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='odevzdavatko.Reseni', verbose_name='reseni'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
database_operations=[],
|
||||||
|
),
|
||||||
|
migrations.SeparateDatabaseAndState(
|
||||||
|
state_operations=[
|
||||||
|
migrations.DeleteModel(
|
||||||
|
name='Hodnoceni',
|
||||||
|
),
|
||||||
|
migrations.DeleteModel(
|
||||||
|
name='PrilohaReseni',
|
||||||
|
),
|
||||||
|
migrations.DeleteModel(
|
||||||
|
name='Reseni',
|
||||||
|
),
|
||||||
|
migrations.DeleteModel(
|
||||||
|
name='Reseni_Resitele',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
database_operations=[
|
||||||
|
migrations.AlterModelTable(
|
||||||
|
name='Hodnoceni', table="mam_hodnoceni",
|
||||||
|
),
|
||||||
|
migrations.AlterModelTable(
|
||||||
|
name='Reseni', table="mam_reseni",
|
||||||
|
),
|
||||||
|
migrations.AlterModelTable(
|
||||||
|
name='Reseni_Resitele', table="mam_reseni_resitele",
|
||||||
|
),
|
||||||
|
migrations.AlterModelTable(
|
||||||
|
name='PrilohaReseni', table="mam_priloha_reseni",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
Loading…
Reference in a new issue