Pavel "LEdoian" Turinsky
7 months ago
16 changed files with 209 additions and 241 deletions
@ -0,0 +1,20 @@ |
|||
# Generated by Django 4.2.11 on 2024-05-01 13:07 |
|||
|
|||
from django.db import migrations, models |
|||
import django.db.models.deletion |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('soustredeni', '0001_split_from_seminar'), |
|||
('galerie', '0011_pre_split_soustredeni'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AlterField( |
|||
model_name='galerie', |
|||
name='soustredeni', |
|||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='soustredeni.soustredeni'), |
|||
), |
|||
] |
@ -0,0 +1,14 @@ |
|||
# Generated by Django 4.2.11 on 2024-05-01 13:35 |
|||
|
|||
from django.db import migrations |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('galerie', '0012_soustredeni_relink'), |
|||
('soustredeni', '0003_post_split_soustredeni'), |
|||
] |
|||
|
|||
operations = [ |
|||
] |
@ -0,0 +1,20 @@ |
|||
# Generated by Django 4.2.11 on 2024-05-01 13:07 |
|||
|
|||
from django.db import migrations, models |
|||
import django.db.models.deletion |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('soustredeni', '0001_split_from_seminar'), |
|||
('prednasky', '0016_pre_split_soustredeni'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AlterField( |
|||
model_name='seznam', |
|||
name='soustredeni', |
|||
field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.PROTECT, to='soustredeni.soustredeni'), |
|||
), |
|||
] |
@ -0,0 +1,14 @@ |
|||
# Generated by Django 4.2.11 on 2024-05-01 13:35 |
|||
|
|||
from django.db import migrations |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('prednasky', '0017_soustredeni_relink'), |
|||
('soustredeni', '0003_post_split_soustredeni'), |
|||
] |
|||
|
|||
operations = [ |
|||
] |
@ -0,0 +1,67 @@ |
|||
# Generated by Django 4.2.11 on 2024-05-01 13:13 |
|||
|
|||
from django.db import migrations |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('seminar', '0123_soustredeni_unmanage'), |
|||
('soustredeni', '0001_split_from_seminar'), |
|||
('galerie', '0012_soustredeni_relink'), |
|||
('prednasky', '0017_soustredeni_relink'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.RemoveField( |
|||
model_name='konfery_ucastnici', |
|||
name='konfera', |
|||
), |
|||
migrations.RemoveField( |
|||
model_name='konfery_ucastnici', |
|||
name='resitel', |
|||
), |
|||
migrations.RemoveField( |
|||
model_name='soustredeni', |
|||
name='organizatori', |
|||
), |
|||
migrations.RemoveField( |
|||
model_name='soustredeni', |
|||
name='rocnik', |
|||
), |
|||
migrations.RemoveField( |
|||
model_name='soustredeni', |
|||
name='ucastnici', |
|||
), |
|||
migrations.RemoveField( |
|||
model_name='soustredeni_organizatori', |
|||
name='organizator', |
|||
), |
|||
migrations.RemoveField( |
|||
model_name='soustredeni_organizatori', |
|||
name='soustredeni', |
|||
), |
|||
migrations.RemoveField( |
|||
model_name='soustredeni_ucastnici', |
|||
name='resitel', |
|||
), |
|||
migrations.RemoveField( |
|||
model_name='soustredeni_ucastnici', |
|||
name='soustredeni', |
|||
), |
|||
migrations.DeleteModel( |
|||
name='Konfera', |
|||
), |
|||
migrations.DeleteModel( |
|||
name='Konfery_Ucastnici', |
|||
), |
|||
migrations.DeleteModel( |
|||
name='Soustredeni', |
|||
), |
|||
migrations.DeleteModel( |
|||
name='Soustredeni_Organizatori', |
|||
), |
|||
migrations.DeleteModel( |
|||
name='Soustredeni_Ucastnici', |
|||
), |
|||
] |
@ -0,0 +1,14 @@ |
|||
# Generated by Django 4.2.11 on 2024-05-01 13:35 |
|||
|
|||
from django.db import migrations |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('seminar', '0124_remove_sous_from_seminar'), |
|||
('soustredeni', '0003_post_split_soustredeni'), |
|||
] |
|||
|
|||
operations = [ |
|||
] |
@ -1,10 +1,13 @@ |
|||
from .tvorba import * |
|||
from .odevzdavatko import * |
|||
from .base import * |
|||
from .soustredeni import * |
|||
from .pomocne import * |
|||
from .treenode import * |
|||
from .novinky import * |
|||
|
|||
from various.models import Nastaveni |
|||
from personalni.models import Organizator, Resitel, Skola, Prijemce, Osoba |
|||
from soustredeni.models import Soustredeni, Soustredeni_Ucastnici, Soustredeni_Organizatori, Konfera, Konfery_Ucastnici |
|||
|
|||
# Kvůli migr. 0041 |
|||
from soustredeni.models import generate_filename_konfera |
|||
|
@ -1,231 +0,0 @@ |
|||
# -*- coding: utf-8 -*- |
|||
import logging |
|||
import os |
|||
|
|||
from django.db import models |
|||
from django.urls import reverse |
|||
from reversion import revisions as reversion |
|||
|
|||
from django.conf import settings |
|||
|
|||
from personalni.models import Resitel, Organizator |
|||
|
|||
from .base import SeminarModelBase |
|||
from seminar.models import tvorba as am |
|||
|
|||
logger = logging.getLogger(__name__) |
|||
|
|||
|
|||
@reversion.register(ignore_duplicates=True) |
|||
class Soustredeni(SeminarModelBase): |
|||
|
|||
class Meta: |
|||
managed = False |
|||
db_table = 'seminar_soustredeni' |
|||
verbose_name = 'Soustředění' |
|||
verbose_name_plural = 'Soustředění' |
|||
ordering = ['-rocnik__rocnik', '-datum_zacatku'] |
|||
|
|||
# Interní ID |
|||
id = models.AutoField(primary_key = True) |
|||
|
|||
rocnik = models.ForeignKey(am.Rocnik, verbose_name='ročník', related_name='soustredeni_old', |
|||
on_delete=models.PROTECT) |
|||
|
|||
datum_zacatku = models.DateField('datum začátku', blank=True, null=True, |
|||
help_text='První den soustředění') |
|||
|
|||
datum_konce = models.DateField('datum konce', blank=True, null=True, |
|||
help_text='Poslední den soustředění') |
|||
|
|||
verejne_db = models.BooleanField('soustředění zveřejněno', db_column='verejne', default=False) |
|||
|
|||
misto = models.CharField('místo soustředění', max_length=256, blank=True, default='', |
|||
help_text='Místo (název obce, volitelně též objektu') |
|||
|
|||
ucastnici = models.ManyToManyField(Resitel, verbose_name='účastníci soustředění', |
|||
related_name='soustredeni_old', |
|||
help_text='Seznam účastníků soustředění', through='Soustredeni_Ucastnici') |
|||
|
|||
organizatori = models.ManyToManyField(Organizator, |
|||
related_name='soustredeni_old', |
|||
verbose_name='Organizátoři soustředění', |
|||
help_text='Seznam organizátorů soustředění', |
|||
through='Soustredeni_Organizatori') |
|||
|
|||
text = models.TextField('text k soustředění (HTML)', blank=True, default='') |
|||
|
|||
TYP_JARNI = 'jarni' |
|||
TYP_PODZIMNI = 'podzimni' |
|||
TYP_VIKEND = 'vikend' |
|||
TYP_VYLET = 'vylet' |
|||
TYP_CHOICES = [ |
|||
(TYP_JARNI, 'Jarní soustředění'), |
|||
(TYP_PODZIMNI, 'Podzimní soustředění'), |
|||
(TYP_VIKEND, 'Víkendový sraz'), |
|||
(TYP_VYLET, 'Výlet'), |
|||
] |
|||
typ = models.CharField('typ akce', max_length=16, choices=TYP_CHOICES, blank=False, default=TYP_PODZIMNI) |
|||
|
|||
exportovat = models.BooleanField('export do AESOPa', db_column='exportovat', default=False, |
|||
help_text='Exportuje se jen podle tohoto flagu (ne veřejnosti)') |
|||
|
|||
def __str__(self): |
|||
return '{} ({})'.format(self.misto, self.datum_zacatku) |
|||
|
|||
def verejne(self): |
|||
return self.verejne_db |
|||
verejne.boolean = True |
|||
|
|||
def verejne_url(self): |
|||
#return reverse('seminar_soustredeni', kwargs={'pk': self.id}) |
|||
return reverse('seminar_seznam_soustredeni') |
|||
|
|||
|
|||
@reversion.register(ignore_duplicates=True) |
|||
class Soustredeni_Ucastnici(SeminarModelBase): |
|||
# zmena dedicnosti z models.Model na SeminarModelBase, potencialni vznik bugu |
|||
|
|||
class Meta: |
|||
managed = False |
|||
db_table = 'seminar_soustredeni_ucastnici' |
|||
verbose_name = 'Účast na soustředění' |
|||
verbose_name_plural = 'Účasti na soustředění' |
|||
ordering = ['soustredeni', 'resitel'] |
|||
|
|||
# Interní ID |
|||
id = models.AutoField(primary_key = True) |
|||
|
|||
resitel = models.ForeignKey(Resitel, verbose_name='řešitel', |
|||
related_name='sous_ucastnici', |
|||
on_delete=models.PROTECT) |
|||
|
|||
soustredeni = models.ForeignKey(Soustredeni, verbose_name='soustředění', |
|||
related_name='sous_ucastnici', |
|||
on_delete=models.PROTECT) |
|||
|
|||
poznamka = models.TextField('neveřejná poznámka', blank=True, |
|||
help_text='Neveřejná poznámka k účasti (plain text)') |
|||
|
|||
def __str__(self): |
|||
return '{} na {}'.format(self.resitel, self.soustredeni) |
|||
# NOTE: Poteciální DB HOG bez select_related |
|||
|
|||
|
|||
@reversion.register(ignore_duplicates=True) |
|||
class Soustredeni_Organizatori(SeminarModelBase): |
|||
# zmena dedicnosti z models.Model na SeminarModelBase, potencialni vznik bugu |
|||
|
|||
class Meta: |
|||
managed = False |
|||
db_table = 'seminar_soustredeni_organizatori' |
|||
verbose_name = 'Účast organizátorů na soustředění' |
|||
verbose_name_plural = 'Účasti organizátorů na soustředění' |
|||
ordering = ['soustredeni', 'organizator'] |
|||
|
|||
# Interní ID |
|||
id = models.AutoField(primary_key = True) |
|||
|
|||
organizator = models.ForeignKey(Organizator, verbose_name='organizátor', |
|||
related_name='sous_orgove', |
|||
on_delete=models.PROTECT) |
|||
|
|||
soustredeni = models.ForeignKey(Soustredeni, verbose_name='soustředění', |
|||
related_name='sous_orgove', |
|||
on_delete=models.PROTECT) |
|||
|
|||
poznamka = models.TextField('neveřejná poznámka', blank=True, |
|||
help_text='Neveřejná poznámka k účasti organizátora (plain text)') |
|||
|
|||
def __str__(self): |
|||
return '{} na {}'.format(self.organizator, self.soustredeni) |
|||
# NOTE: Poteciální DB HOG bez select_related |
|||
|
|||
|
|||
# FIXME cycle import |
|||
|
|||
|
|||
# Django neumí jednoduše serializovat partial nebo třídu s __call__ |
|||
# (https://docs.djangoproject.com/en/1.8/topics/migrations/), |
|||
# neprojdou pak migrace. Takže rozlišení funkcí generujících názvy souboru |
|||
# podle adresáře řešíme takto. |
|||
|
|||
## |
|||
def generate_filename_konfera(self, filename): |
|||
return os.path.join( |
|||
settings.SEMINAR_KONFERY_DIR, |
|||
am.aux_generate_filename(self, filename) |
|||
) |
|||
|
|||
## |
|||
|
|||
@reversion.register(ignore_duplicates=True) |
|||
class Konfera(am.Problem): |
|||
class Meta: |
|||
managed = False |
|||
db_table = 'seminar_konfera' |
|||
verbose_name = 'Konfera' |
|||
verbose_name_plural = 'Konfery' |
|||
|
|||
problem_ptr_old = models.OneToOneField(am.Problem, parent_link=True, related_name='konfera_old', on_delete=models.PROTECT, primary_key=True) |
|||
|
|||
anotace = models.TextField('anotace', blank=True, |
|||
help_text='Popis, o čem bude konfera.') |
|||
|
|||
abstrakt = models.TextField('abstrakt', blank=True, |
|||
help_text='Abstrakt konfery tak, jak byl uveden ve sborníku') |
|||
|
|||
# FIXME: Umíme omezit jen na účastníky daného soustřeďka? |
|||
ucastnici = models.ManyToManyField(Resitel, verbose_name='účastníci konfery', |
|||
related_name='konfera_old', |
|||
help_text='Seznam účastníků konfery', through='Konfery_Ucastnici') |
|||
|
|||
soustredeni = models.ForeignKey(Soustredeni, verbose_name='soustředění', |
|||
related_name='konfery_old', on_delete = models.SET_NULL, null=True) |
|||
|
|||
TYP_VELETRH = 'veletrh' |
|||
TYP_PREZENTACE = 'prezentace' |
|||
TYP_CHOICES = [ |
|||
(TYP_VELETRH, 'Veletrh (postery)'), |
|||
(TYP_PREZENTACE, 'Prezentace (přednáška)'), |
|||
] |
|||
typ_prezentace = models.CharField('typ prezentace', max_length=16, choices=TYP_CHOICES, |
|||
blank=False, default=TYP_VELETRH) |
|||
|
|||
prezentace = models.FileField('prezentace',help_text = 'Prezentace nebo fotka posteru', |
|||
upload_to = generate_filename_konfera, blank=True) |
|||
|
|||
materialy = models.FileField('materialy', |
|||
help_text = 'Další materiály ke konfeře zabalené do jednoho souboru', |
|||
upload_to = generate_filename_konfera, blank=True) |
|||
|
|||
def __str__(self): |
|||
return "{}: ({})".format(self.nazev, self.soustredeni) |
|||
|
|||
def cislo_node(self): |
|||
return None |
|||
|
|||
|
|||
@reversion.register(ignore_duplicates=True) |
|||
class Konfery_Ucastnici(models.Model): |
|||
|
|||
class Meta: |
|||
managed = False |
|||
db_table = 'seminar_konfery_ucastnici' |
|||
verbose_name = 'Účast na konfeře' |
|||
verbose_name_plural = 'Účasti na konfeře' |
|||
ordering = ['konfera', 'resitel'] |
|||
|
|||
# Interní ID |
|||
id = models.AutoField(primary_key = True) |
|||
|
|||
resitel = models.ForeignKey(Resitel, verbose_name='řešitel', on_delete=models.PROTECT, related_name='konf_uc') |
|||
|
|||
konfera = models.ForeignKey(Konfera, verbose_name='konfera', on_delete=models.CASCADE, related_name='konf_uc') |
|||
|
|||
poznamka = models.TextField('neveřejná poznámka', blank=True, |
|||
help_text='Neveřejná poznámka k účasti (plain text)') |
|||
|
|||
def __str__(self): |
|||
return '{} na {}'.format(self.resitel, self.konfera) |
|||
# NOTE: Poteciální DB HOG bez select_related |
@ -0,0 +1,34 @@ |
|||
# Generated by Django 4.2.11 on 2024-05-01 13:18 |
|||
|
|||
from django.db import migrations |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('soustredeni', '0001_split_from_seminar'), |
|||
('seminar', '0124_remove_sous_from_seminar'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AlterModelOptions( |
|||
name='konfera', |
|||
options={'verbose_name': 'Konfera', 'verbose_name_plural': 'Konfery'}, |
|||
), |
|||
migrations.AlterModelOptions( |
|||
name='konfery_ucastnici', |
|||
options={'ordering': ['konfera', 'resitel'], 'verbose_name': 'Účast na konfeře', 'verbose_name_plural': 'Účasti na konfeře'}, |
|||
), |
|||
migrations.AlterModelOptions( |
|||
name='soustredeni', |
|||
options={'ordering': ['-rocnik__rocnik', '-datum_zacatku'], 'verbose_name': 'Soustředění', 'verbose_name_plural': 'Soustředění'}, |
|||
), |
|||
migrations.AlterModelOptions( |
|||
name='soustredeni_organizatori', |
|||
options={'ordering': ['soustredeni', 'organizator'], 'verbose_name': 'Účast organizátorů na soustředění', 'verbose_name_plural': 'Účasti organizátorů na soustředění'}, |
|||
), |
|||
migrations.AlterModelOptions( |
|||
name='soustredeni_ucastnici', |
|||
options={'ordering': ['soustredeni', 'resitel'], 'verbose_name': 'Účast na soustředění', 'verbose_name_plural': 'Účasti na soustředění'}, |
|||
), |
|||
] |
@ -0,0 +1,13 @@ |
|||
# Generated by Django 4.2.11 on 2024-05-01 13:35 |
|||
|
|||
from django.db import migrations |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('soustredeni', '0002_manage_soustredeni'), |
|||
] |
|||
|
|||
operations = [ |
|||
] |
Loading…
Reference in new issue