I did something!
This commit is contained in:
parent
a23daf8b97
commit
46f1d3d42d
3 changed files with 2 additions and 27 deletions
|
@ -28,6 +28,7 @@ class Migration(migrations.Migration):
|
|||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('cena_sous', models.IntegerField(default=1000, verbose_name='Účastnický poplatek za soustředění')),
|
||||
('aktualni_cislo', models.ForeignKey(null=True, on_delete=models.deletion.PROTECT, to='seminar.cislo', verbose_name='Aktuální číslo')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Nastavení semináře',
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
# 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'),
|
||||
),
|
||||
]
|
|
@ -7,10 +7,6 @@ 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().id
|
||||
|
||||
@reversion.register(ignore_duplicates=True)
|
||||
class Nastaveni(SingletonModel):
|
||||
|
||||
|
@ -22,8 +18,7 @@ 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,
|
||||
default=_default_aktualni_cislo,
|
||||
null=True, blank=False, on_delete=models.PROTECT,
|
||||
)
|
||||
|
||||
cena_sous = models.IntegerField(null=False,
|
||||
|
|
Loading…
Reference in a new issue