Compare commits

...

7 Commits

Author SHA1 Message Date
Pavel 'LEdoian' Turinsky d21ac37187 vazba 7 months ago
Pavel 'LEdoian' Turinsky 49f9b05285 nezapomenout vazby… 7 months ago
Pavel 'LEdoian' Turinsky a17914f49c Personalni: managed = True + makemigrations 7 months ago
Pavel 'LEdoian' Turinsky b4b41b9499 Přidání závislostí do delete 7 months ago
Pavel 'LEdoian' Turinsky 1a3dd5d6b2 Jak zařídit, že model bude managed 7 months ago
Pavel 'LEdoian' Turinsky 54db53805a Nezapomenout na vazby 7 months ago
Pavel 'LEdoian' Turinsky b17b97e4e4 OrgSkolyAutocompleteTestCase: jde vypnout 7 months ago
  1. 3
      api/tests/test_skola_autocomplete.py
  2. 34
      personalni/migrations/0004_alter_organizator_options_alter_osoba_options_and_more.py
  3. 5
      personalni/models.py
  4. 4
      seminar/migrations/0120_remove_osoba_user_remove_prijemce_osoba_and_more.py
  5. 1
      split-apps-meta/delete.notes
  6. 4
      split-apps-meta/manage.notes

3
api/tests/test_skola_autocomplete.py

@ -1,9 +1,10 @@
from django.test import TestCase from django.test import TestCase, tag
from django.urls import reverse from django.urls import reverse
import seminar.models as m import seminar.models as m
import seminar.views as v import seminar.views as v
from seminar.utils import sync_skoly from seminar.utils import sync_skoly
@tag('stejny-model-na-produkci')
class OrgSkolyAutocompleteTestCase(TestCase): class OrgSkolyAutocompleteTestCase(TestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):

34
personalni/migrations/0004_alter_organizator_options_alter_osoba_options_and_more.py

@ -0,0 +1,34 @@
# Generated by Django 4.2.11 on 2024-03-26 21:11
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('personalni', '0003_initial'),
('seminar', '0120_remove_osoba_user_remove_prijemce_osoba_and_more'),
]
operations = [
migrations.AlterModelOptions(
name='organizator',
options={'ordering': ['-organizuje_do', 'osoba__jmeno', 'osoba__prijmeni'], 'verbose_name': 'Organizátor', 'verbose_name_plural': 'Organizátoři'},
),
migrations.AlterModelOptions(
name='osoba',
options={'ordering': ['prijmeni', 'jmeno'], 'verbose_name': 'Osoba', 'verbose_name_plural': 'Osoby'},
),
migrations.AlterModelOptions(
name='prijemce',
options={'verbose_name': 'příjemce', 'verbose_name_plural': 'příjemce'},
),
migrations.AlterModelOptions(
name='resitel',
options={'ordering': ['osoba'], 'verbose_name': 'Řešitel', 'verbose_name_plural': 'Řešitelé'},
),
migrations.AlterModelOptions(
name='skola',
options={'ordering': ['mesto', 'nazev'], 'verbose_name': 'Škola', 'verbose_name_plural': 'Školy'},
),
]

5
personalni/models.py

@ -25,7 +25,6 @@ class Osoba(SeminarModelBase):
verbose_name = 'Osoba' verbose_name = 'Osoba'
verbose_name_plural = 'Osoby' verbose_name_plural = 'Osoby'
ordering = ['prijmeni','jmeno'] ordering = ['prijmeni','jmeno']
managed = False
id = models.AutoField(primary_key = True) id = models.AutoField(primary_key = True)
@ -129,7 +128,6 @@ class Skola(SeminarModelBase):
verbose_name = 'Škola' verbose_name = 'Škola'
verbose_name_plural = 'Školy' verbose_name_plural = 'Školy'
ordering = ['mesto', 'nazev'] ordering = ['mesto', 'nazev']
managed = False
# Interní ID # Interní ID
id = models.AutoField(primary_key = True) id = models.AutoField(primary_key = True)
@ -182,7 +180,6 @@ class Prijemce(SeminarModelBase):
db_table = 'seminar_prijemce' db_table = 'seminar_prijemce'
verbose_name = 'příjemce' verbose_name = 'příjemce'
verbose_name_plural = 'příjemce' verbose_name_plural = 'příjemce'
managed = False
# Interní ID # Interní ID
@ -212,7 +209,6 @@ class Resitel(SeminarModelBase):
verbose_name = 'Řešitel' verbose_name = 'Řešitel'
verbose_name_plural = 'Řešitelé' verbose_name_plural = 'Řešitelé'
ordering = ['osoba'] ordering = ['osoba']
managed = False
# Interní ID # Interní ID
id = models.AutoField(primary_key = True) id = models.AutoField(primary_key = True)
@ -409,7 +405,6 @@ class Organizator(SeminarModelBase):
# TODO: Sjednotit s tím, jak se řadí organizátoři v seznau orgů na webu # TODO: Sjednotit s tím, jak se řadí organizátoři v seznau orgů na webu
db_table = 'seminar_organizator' db_table = 'seminar_organizator'
ordering = ['-organizuje_do', 'osoba__jmeno', 'osoba__prijmeni'] ordering = ['-organizuje_do', 'osoba__jmeno', 'osoba__prijmeni']
managed = False
osoba = models.OneToOneField(Osoba, verbose_name='osoba', related_name='org', osoba = models.OneToOneField(Osoba, verbose_name='osoba', related_name='org',
help_text='osobní údaje organizátora', null=False, blank=False, help_text='osobní údaje organizátora', null=False, blank=False,

4
seminar/migrations/0120_remove_osoba_user_remove_prijemce_osoba_and_more.py

@ -7,6 +7,10 @@ class Migration(migrations.Migration):
dependencies = [ dependencies = [
('seminar', '0119_alter_konfera_ucastnici_and_more'), ('seminar', '0119_alter_konfera_ucastnici_and_more'),
('personalni', '0003_initial'),
('korektury', '0022_alter_komentar_autor_alter_korekturovanepdf_org_and_more'),
('prednasky', '0014_alter_prednaska_org'),
('sifrovacka', '0005_alter_odpoveducastnika_resitel'),
] ]
operations = [ operations = [

1
split-apps-meta/delete.notes

@ -2,6 +2,7 @@ Prostě to smazat.
makemigrations makemigrations
Kromě triviální smazání modelů se smažou i jejich vazby, to je snad OK. Kromě triviální smazání modelů se smažou i jejich vazby, to je snad OK.
(Hypotéza: kvůli konzistenčním kontrolám v DB?) (Hypotéza: kvůli konzistenčním kontrolám v DB?)
Doplnit vazby na relinky a vznik nového modelu
migrate migrate
a doufat :-P a doufat :-P

4
split-apps-meta/manage.notes

@ -0,0 +1,4 @@
1. smazat `managed = False`
2. makemigrations
Vazba na delete!
3. migrate
Loading…
Cancel
Save