|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
from django.db import models
|
|
|
|
from django.utils.encoding import python_2_unicode_compatible
|
|
|
|
from django.utils.encoding import force_unicode
|
|
|
|
|
|
|
|
from seminar.models import Organizator,Soustredeni
|
|
|
|
|
|
|
|
STAV_NAVRH = 1
|
|
|
|
STAV_BUDE = 2
|
|
|
|
|
|
|
|
|
|
|
|
STAV_CHOICES = (
|
|
|
|
(STAV_NAVRH, 'Návrh'),
|
|
|
|
(STAV_BUDE, 'Bude')
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@python_2_unicode_compatible
|
|
|
|
class Seznam(models.Model):
|
|
|
|
class Meta:
|
|
|
|
db_table = 'prednasky_seznam'
|
|
|
|
verbose_name = u'Seznam přednášek'
|
|
|
|
verbose_name_plural = u'Seznamy přednášek'
|
|
|
|
ordering = ['soustredeni', 'stav']
|
|
|
|
|
|
|
|
id = models.AutoField(primary_key = True)
|
|
|
|
soustredeni = models.ForeignKey(Soustredeni,null = True, default = None)
|
|
|
|
stav = models.IntegerField('Stav',choices=STAV_CHOICES,default = STAV_NAVRH)
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return force_unicode(u"Seznam {}přednášek na {}".format(u"návrhů " if self.stav == STAV_NAVRH else "",self.soustredeni))
|
|
|
|
|
|
|
|
|
|
|
|
CHOICES_OBTIZNOST = (
|
|
|
|
(1, 'Lehká'),
|
|
|
|
(2, 'Střední'),
|
|
|
|
(3, 'Těžká'),
|
|
|
|
)
|
|
|
|
|
|
|
|
CHOICES_BODY = (
|
|
|
|
(-1, '-1'),
|
|
|
|
(0, '0'),
|
|
|
|
(1, '1'),
|
|
|
|
)
|
|
|
|
|
|
|
|
@python_2_unicode_compatible
|
|
|
|
class Prednaska(models.Model):
|
|
|
|
class Meta:
|
|
|
|
db_table = 'prednasky_prednaska'
|
|
|
|
verbose_name = u'Přednáška'
|
|
|
|
verbose_name_plural = u'Přednášky'
|
|
|
|
ordering = ['org', 'nazev']
|
|
|
|
|
|
|
|
id = models.AutoField(primary_key = True)
|
|
|
|
nazev = models.CharField(u'Název', max_length = 300)
|
|
|
|
org = models.ForeignKey(Organizator)
|
|
|
|
popis = models.TextField(u'Popis pro orgy',null = True, blank = True,help_text = u'Neveřejný popis pro ostatní orgy')
|
|
|
|
anotace = models.TextField('Anotace',null = True, blank = True, help_text = u'Veřejná anotace v hlasování')
|
|
|
|
obtiznost = models.IntegerField(u'Obtížnost', choices=CHOICES_OBTIZNOST)
|
|
|
|
obor = models.CharField(u'Obor', max_length = 5, help_text = u'Podmnožina MFIOB')
|
|
|
|
klicova = models.CharField(u'Klíčová slova', max_length = 200, null = True, blank = True)
|
|
|
|
seznamy = models.ManyToManyField(Seznam)
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return force_unicode(u"{} ({})".format(self.nazev,self.org))
|
|
|
|
|
|
|
|
|
|
|
|
@python_2_unicode_compatible
|
|
|
|
class Hlasovani(models.Model):
|
|
|
|
class Meta:
|
|
|
|
db_table = 'prednasky_hlasovani'
|
|
|
|
verbose_name = u'Hlasování'
|
|
|
|
verbose_name_plural = u'Hlasování'
|
|
|
|
ordering = ['ucastnik', 'prednaska']
|
|
|
|
id = models.AutoField(primary_key = True)
|
|
|
|
prednaska = models.ForeignKey(Prednaska)
|
|
|
|
body = models.IntegerField('Body', default = 0, choices = CHOICES_BODY)
|
|
|
|
ucastnik = models.CharField('Účastník', max_length = 100)
|
|
|
|
seznam = models.ForeignKey(Seznam)
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return force_unicode(u"{} dal {} bodů {} v seznamu {}".format(self.ucastnik, self.body, self.prednaska,self.seznam))
|
|
|
|
|