|
|
@ -16,6 +16,7 @@ from imagekit.processors import ResizeToFit, Transpose |
|
|
|
|
|
|
|
from PIL import Image |
|
|
|
import os |
|
|
|
from functools import partial |
|
|
|
from cStringIO import StringIO |
|
|
|
from django.core.files.base import ContentFile |
|
|
|
|
|
|
@ -544,13 +545,13 @@ class Reseni(SeminarModelBase): |
|
|
|
|
|
|
|
|
|
|
|
# PrilohaReseni method |
|
|
|
def generate_filename(self, filename): |
|
|
|
def generate_filename(self, filename, directory): |
|
|
|
clean = filename.replace('/','-').replace('\0', '') |
|
|
|
datedir = timezone.now().strftime('%Y-%m') |
|
|
|
fname = "%s_%s" % ( |
|
|
|
timezone.now().strftime('%Y-%m-%d-%H:%M'), |
|
|
|
clean) |
|
|
|
return os.path.join(settings.SEMINAR_RESENI_DIR, datedir, fname) |
|
|
|
return os.path.join(directory, datedir, fname) |
|
|
|
|
|
|
|
|
|
|
|
@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) |
|
|
|
|
|
|
|
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, |
|
|
|
help_text=u'Neveřejná poznámka k příloze řešení (plain text), např. o původu') |
|
|
@ -734,6 +735,47 @@ class Soustredeni_Organizatori(models.Model): |
|
|
|
# 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 #TODO |
|
|
|
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)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@python_2_unicode_compatible |
|
|
|
class VysledkyBase(SeminarModelBase): |
|
|
|
|
|
|
|