|
@ -16,6 +16,7 @@ from imagekit.processors import ResizeToFit, Transpose |
|
|
|
|
|
|
|
|
from PIL import Image |
|
|
from PIL import Image |
|
|
import os |
|
|
import os |
|
|
|
|
|
from functools import partial |
|
|
from cStringIO import StringIO |
|
|
from cStringIO import StringIO |
|
|
from django.core.files.base import ContentFile |
|
|
from django.core.files.base import ContentFile |
|
|
|
|
|
|
|
@ -23,7 +24,7 @@ from django_countries.fields import CountryField |
|
|
from solo.models import SingletonModel |
|
|
from solo.models import SingletonModel |
|
|
from taggit.managers import TaggableManager |
|
|
from taggit.managers import TaggableManager |
|
|
|
|
|
|
|
|
import reversion |
|
|
from reversion import revisions as reversion |
|
|
|
|
|
|
|
|
from seminar.utils import roman |
|
|
from seminar.utils import roman |
|
|
|
|
|
|
|
@ -544,13 +545,13 @@ class Reseni(SeminarModelBase): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# PrilohaReseni method |
|
|
# PrilohaReseni method |
|
|
def generate_filename(self, filename): |
|
|
def generate_filename(self, filename, directory): |
|
|
clean = filename.replace('/','-').replace('\0', '') |
|
|
clean = filename.replace('/','-').replace('\0', '') |
|
|
datedir = timezone.now().strftime('%Y-%m') |
|
|
datedir = timezone.now().strftime('%Y-%m') |
|
|
fname = "%s_%s" % ( |
|
|
fname = "%s_%s" % ( |
|
|
timezone.now().strftime('%Y-%m-%d-%H:%M'), |
|
|
timezone.now().strftime('%Y-%m-%d-%H:%M'), |
|
|
clean) |
|
|
clean) |
|
|
return os.path.join(settings.SEMINAR_RESENI_DIR, datedir, fname) |
|
|
return os.path.join(directory, datedir, fname) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@reversion.register(ignore_duplicate_revisions=True) |
|
|
@reversion.register(ignore_duplicate_revisions=True) |
|
@ -570,7 +571,7 @@ class PrilohaReseni(SeminarModelBase): |
|
|
|
|
|
|
|
|
timestamp = models.DateTimeField(u'vytvořeno', default=timezone.now, blank=True, editable=False) |
|
|
timestamp = models.DateTimeField(u'vytvořeno', default=timezone.now, blank=True, editable=False) |
|
|
|
|
|
|
|
|
soubor = models.FileField(u'soubor', upload_to = generate_filename) |
|
|
soubor = models.FileField(u'soubor', upload_to = partial(generate_filename,directory=settings.SEMINAR_RESENI_DIR)) |
|
|
|
|
|
|
|
|
poznamka = models.TextField(u'neveřejná poznámka', blank=True, |
|
|
poznamka = models.TextField(u'neveřejná poznámka', blank=True, |
|
|
help_text=u'Neveřejná poznámka k příloze řešení (plain text), např. o původu') |
|
|
help_text=u'Neveřejná poznámka k příloze řešení (plain text), např. o původu') |
|
@ -734,6 +735,72 @@ class Soustredeni_Organizatori(models.Model): |
|
|
# NOTE: Poteciální DB HOG bez select_related |
|
|
# NOTE: Poteciální DB HOG bez select_related |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@reversion.register(ignore_duplicate_revisions=True) |
|
|
|
|
|
@python_2_unicode_compatible |
|
|
|
|
|
class Konfera(models.Model): |
|
|
|
|
|
class Meta: |
|
|
|
|
|
db_table = 'seminar_konfera' |
|
|
|
|
|
verbose_name = u'Konfera' |
|
|
|
|
|
verbose_name_plural = u'Konfery' |
|
|
|
|
|
# Interní ID |
|
|
|
|
|
id = models.AutoField(primary_key = True) |
|
|
|
|
|
nazev = models.CharField(u'název konfery', max_length=40, help_text = u'Název konfery') |
|
|
|
|
|
popis = models.TextField(u'popis konfery', blank=True, |
|
|
|
|
|
help_text=u'Popis konfery k zobrazení na webu') |
|
|
|
|
|
abstrakt = models.TextField(u'abstrakt', blank=True, |
|
|
|
|
|
help_text=u'Abstrakt konfery tak, jak byl uveden ve sborníku') |
|
|
|
|
|
organizator = models.ForeignKey(Organizator, verbose_name=u'organizátor', related_name='konfery', |
|
|
|
|
|
on_delete = models.SET_NULL, null=True) |
|
|
|
|
|
ucastnici = models.ManyToManyField(Resitel, verbose_name=u'účastníci konfery', |
|
|
|
|
|
help_text=u'Seznam účastníků konfery', through='Konfery_Ucastnici') |
|
|
|
|
|
soustredeni = models.ForeignKey(Soustredeni, verbose_name=u'soustředění', related_name='konfery', |
|
|
|
|
|
on_delete = models.SET_NULL, null=True) |
|
|
|
|
|
org_poznamka = models.TextField(u'neveřejná poznámka', blank=True, |
|
|
|
|
|
help_text=u'Neveřejná poznámka ke konfeře(plain text)') |
|
|
|
|
|
#prispevek #TODO |
|
|
|
|
|
TYP_VELETRH = 'veletrh' |
|
|
|
|
|
TYP_PREZENTACE = 'prezentace' |
|
|
|
|
|
TYP_CHOICES = [ |
|
|
|
|
|
(TYP_VELETRH, u'Veletrh (postery)'), |
|
|
|
|
|
(TYP_PREZENTACE, u'Prezentace (přednáška)'), |
|
|
|
|
|
] |
|
|
|
|
|
typ_prezentace = models.CharField(u'typ prezentace', max_length=16, choices=TYP_CHOICES, blank=False, default=TYP_VELETRH) |
|
|
|
|
|
prezentace = models.FileField(u'prezentace',help_text = u'Prezentace nebo fotka posteru', |
|
|
|
|
|
upload_to = partial(generate_filename,directory=settings.SEMINAR_KONFERY_DIR)) |
|
|
|
|
|
materialy = models.FileField(u'materialy',help_text = u'Další materiály ke konfeře zabalené do jednoho souboru', |
|
|
|
|
|
upload_to = partial(generate_filename,directory=settings.SEMINAR_KONFERY_DIR)) |
|
|
|
|
|
|
|
|
|
|
|
def __str__(self): |
|
|
|
|
|
return force_unicode(u"%s: (%s)" % (self.nazev, self.soustredeni)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@reversion.register(ignore_duplicate_revisions=True) |
|
|
|
|
|
@python_2_unicode_compatible |
|
|
|
|
|
class Konfery_Ucastnici(models.Model): |
|
|
|
|
|
|
|
|
|
|
|
class Meta: |
|
|
|
|
|
db_table = 'seminar_konfery_ucastnici' |
|
|
|
|
|
verbose_name = u'Účast na konfeře' |
|
|
|
|
|
verbose_name_plural = u'Účasti na konfeře' |
|
|
|
|
|
ordering = ['konfera', 'resitel'] |
|
|
|
|
|
|
|
|
|
|
|
# Interní ID |
|
|
|
|
|
id = models.AutoField(primary_key = True) |
|
|
|
|
|
|
|
|
|
|
|
resitel = models.ForeignKey(Resitel, verbose_name=u'řešitel') |
|
|
|
|
|
|
|
|
|
|
|
konfera = models.ForeignKey(Konfera, verbose_name=u'konfera') |
|
|
|
|
|
|
|
|
|
|
|
poznamka = models.TextField(u'neveřejná poznámka', blank=True, |
|
|
|
|
|
help_text=u'Neveřejná poznámka k účasti (plain text)') |
|
|
|
|
|
|
|
|
|
|
|
def __str__(self): |
|
|
|
|
|
return force_unicode(u'%s na %s' % (self.resitel, self.konfera, )) |
|
|
|
|
|
# NOTE: Poteciální DB HOG bez select_related |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@python_2_unicode_compatible |
|
|
@python_2_unicode_compatible |
|
|
class VysledkyBase(SeminarModelBase): |
|
|
class VysledkyBase(SeminarModelBase): |
|
|
|
|
|
|
|
|