Web M&M
https://mam.matfyz.cz
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
44 lines
1.1 KiB
from django.db import models
|
|
|
|
from reversion import revisions as reversion
|
|
from solo.models import SingletonModel
|
|
|
|
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):
|
|
|
|
class Meta:
|
|
db_table = 'seminar_nastaveni'
|
|
verbose_name = 'Nastavení semináře'
|
|
|
|
# aktualni_rocnik = models.ForeignKey(Rocnik, verbose_name='aktuální ročník',
|
|
# 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,
|
|
)
|
|
|
|
cena_sous = models.IntegerField(null=False,
|
|
verbose_name="Účastnický poplatek za soustředění",
|
|
default=1000)
|
|
|
|
@property
|
|
def aktualni_rocnik(self):
|
|
return self.aktualni_cislo.rocnik
|
|
|
|
def __str__(self):
|
|
return 'Nastavení semináře'
|
|
|
|
def admin_url(self):
|
|
return reverse('admin:seminar_nastaveni_change', args=(self.id, ))
|
|
|
|
def verejne(self):
|
|
return False
|
|
|