Browse Source

Wtf nastaveni.aktualni_cislo nebylo??!?!

Nějaká bullshit migrace, whatever.
pull/43/head
Pavel 'LEdoian' Turinsky 8 months ago
parent
commit
b550857a8d
  1. 21
      various/migrations/0004_nastaveni_aktualni_cislo.py
  2. 8
      various/models.py

21
various/migrations/0004_nastaveni_aktualni_cislo.py

@ -0,0 +1,21 @@
# Generated by Django 4.2.8 on 2024-03-12 20:44
from django.db import migrations, models
import django.db.models.deletion
import various.models
class Migration(migrations.Migration):
dependencies = [
('seminar', '0118_alter_organizator_options_alter_osoba_options_and_more'),
('various', '0003_fix_permissions'),
]
operations = [
migrations.AddField(
model_name='nastaveni',
name='aktualni_cislo',
field=models.ForeignKey(default=various.models._default_aktualni_cislo, on_delete=django.db.models.deletion.PROTECT, to='seminar.cislo', verbose_name='Aktuální číslo'),
),
]

8
various/models.py

@ -7,6 +7,10 @@ from seminar.models import Cislo
from django.urls import reverse
# Whatever, makemigrations chce default, má ho mít lol.
def _default_aktualni_cislo():
return Cislo.objects.last()
@reversion.register(ignore_duplicates=True)
class Nastaveni(SingletonModel):
@ -18,7 +22,9 @@ class Nastaveni(SingletonModel):
# null=False, on_delete=models.PROTECT)
aktualni_cislo = models.ForeignKey(Cislo, verbose_name='Aktuální číslo',
null=False, on_delete=models.PROTECT)
null=False, on_delete=models.PROTECT,
default=_default_aktualni_cislo,
)
cena_sous = models.IntegerField(null=False,
verbose_name="Účastnický poplatek za soustředění",

Loading…
Cancel
Save