zmeny pro kompatibilitu s python3
This commit is contained in:
parent
8972dbb34d
commit
dd99c34a83
4 changed files with 53 additions and 51 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
#from django.db.models import Q
|
#from django.db.models import Q
|
||||||
from django.utils.encoding import force_unicode
|
from django.utils.encoding import force_text
|
||||||
from imagekit.models import ImageSpecField
|
from imagekit.models import ImageSpecField
|
||||||
from imagekit.processors import ResizeToFit, Transpose
|
from imagekit.processors import ResizeToFit, Transpose
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ from django.db import models
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
from django.utils.encoding import force_unicode
|
from django.utils.encoding import force_text
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.utils.text import get_valid_filename
|
from django.utils.text import get_valid_filename
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
from django.utils.encoding import force_unicode
|
from django.utils.encoding import force_text
|
||||||
|
|
||||||
from seminar.models import Organizator,Soustredeni
|
from seminar.models import Organizator, Soustredeni
|
||||||
|
|
||||||
STAV_NAVRH = 1
|
STAV_NAVRH = 1
|
||||||
STAV_BUDE = 2
|
STAV_BUDE = 2
|
||||||
|
@ -18,67 +18,69 @@ STAV_CHOICES = (
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class Seznam(models.Model):
|
class Seznam(models.Model):
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = 'prednasky_seznam'
|
db_table = 'prednasky_seznam'
|
||||||
verbose_name = u'Seznam přednášek'
|
verbose_name = 'Seznam přednášek'
|
||||||
verbose_name_plural = u'Seznamy přednášek'
|
verbose_name_plural = 'Seznamy přednášek'
|
||||||
ordering = ['soustredeni', 'stav']
|
ordering = ['soustredeni', 'stav']
|
||||||
|
|
||||||
id = models.AutoField(primary_key = True)
|
id = models.AutoField(primary_key = True)
|
||||||
soustredeni = models.ForeignKey(Soustredeni,null = True, default = None)
|
soustredeni = models.ForeignKey(Soustredeni,null = True, default = None)
|
||||||
stav = models.IntegerField('Stav',choices=STAV_CHOICES,default = STAV_NAVRH)
|
stav = models.IntegerField('Stav',choices=STAV_CHOICES,default = STAV_NAVRH)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return force_unicode(u"Seznam {}přednášek na {}".format(u"návrhů " if self.stav == STAV_NAVRH else "",self.soustredeni))
|
return force_unicode("Seznam {}přednášek na {}".format("návrhů "
|
||||||
|
if self.stav == STAV_NAVRH else "", self.soustredeni))
|
||||||
|
|
||||||
|
|
||||||
CHOICES_OBTIZNOST = (
|
CHOICES_OBTIZNOST = (
|
||||||
(1, 'Lehká'),
|
(1, 'Lehká'),
|
||||||
(2, 'Střední'),
|
(2, 'Střední'),
|
||||||
(3, 'Těžká'),
|
(3, 'Těžká'),
|
||||||
)
|
)
|
||||||
|
|
||||||
CHOICES_BODY = (
|
CHOICES_BODY = (
|
||||||
(-1, '-1'),
|
(-1, '-1'),
|
||||||
(0, '0'),
|
(0, '0'),
|
||||||
(1, '1'),
|
(1, '1'),
|
||||||
)
|
)
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class Prednaska(models.Model):
|
class Prednaska(models.Model):
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = 'prednasky_prednaska'
|
db_table = 'prednasky_prednaska'
|
||||||
verbose_name = u'Přednáška'
|
verbose_name = 'Přednáška'
|
||||||
verbose_name_plural = u'Přednášky'
|
verbose_name_plural = 'Přednášky'
|
||||||
ordering = ['org', 'nazev']
|
ordering = ['org', 'nazev']
|
||||||
|
|
||||||
id = models.AutoField(primary_key = True)
|
id = models.AutoField(primary_key = True)
|
||||||
nazev = models.CharField(u'Název', max_length = 300)
|
nazev = models.CharField('Název', max_length = 300)
|
||||||
org = models.ForeignKey(Organizator)
|
org = models.ForeignKey(Organizator)
|
||||||
popis = models.TextField(u'Popis pro orgy',null = True, blank = True,help_text = u'Neveřejný popis pro ostatní orgy')
|
popis = models.TextField('Popis pro orgy',null = True, blank = True,help_text = 'Neveřejný popis pro ostatní orgy')
|
||||||
anotace = models.TextField('Anotace',null = True, blank = True, help_text = u'Veřejná anotace v hlasování')
|
anotace = models.TextField('Anotace',null = True, blank = True, help_text = 'Veřejná anotace v hlasování')
|
||||||
obtiznost = models.IntegerField(u'Obtížnost', choices=CHOICES_OBTIZNOST)
|
obtiznost = models.IntegerField('Obtížnost', choices=CHOICES_OBTIZNOST)
|
||||||
obor = models.CharField(u'Obor', max_length = 5, help_text = u'Podmnožina MFIOB')
|
obor = models.CharField('Obor', max_length = 5, help_text = 'Podmnožina MFIOB')
|
||||||
klicova = models.CharField(u'Klíčová slova', max_length = 200, null = True, blank = True)
|
klicova = models.CharField('Klíčová slova', max_length = 200, null = True, blank = True)
|
||||||
seznamy = models.ManyToManyField(Seznam)
|
seznamy = models.ManyToManyField(Seznam)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return force_unicode(u"{} ({})".format(self.nazev,self.org))
|
return force_unicode(u"{} ({})".format(self.nazev, self.org))
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class Hlasovani(models.Model):
|
class Hlasovani(models.Model):
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = 'prednasky_hlasovani'
|
db_table = 'prednasky_hlasovani'
|
||||||
verbose_name = u'Hlasování'
|
verbose_name = 'Hlasování'
|
||||||
verbose_name_plural = u'Hlasování'
|
verbose_name_plural = 'Hlasování'
|
||||||
ordering = ['ucastnik', 'prednaska']
|
ordering = ['ucastnik', 'prednaska']
|
||||||
id = models.AutoField(primary_key = True)
|
id = models.AutoField(primary_key = True)
|
||||||
prednaska = models.ForeignKey(Prednaska)
|
prednaska = models.ForeignKey(Prednaska)
|
||||||
body = models.IntegerField('Body', default = 0, choices = CHOICES_BODY)
|
body = models.IntegerField('Body', default = 0, choices = CHOICES_BODY)
|
||||||
ucastnik = models.CharField('Účastník', max_length = 100)
|
ucastnik = models.CharField('Účastník', max_length = 100)
|
||||||
seznam = models.ForeignKey(Seznam)
|
seznam = models.ForeignKey(Seznam)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return force_unicode(u"{} dal {} bodů {} v seznamu {}".format(self.ucastnik, self.body, self.prednaska,self.seznam))
|
return force_unicode("{} dal {} bodů {} v seznamu {}".format(self.ucastnik,
|
||||||
|
self.body, self.prednaska, self.seznam))
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
from autocomplete_light import shortcuts as autocomplete_light
|
from autocomplete_light import shortcuts as autocomplete_light
|
||||||
|
|
||||||
from models import Skola, Resitel, Problem, Organizator
|
from .models import Skola, Resitel, Problem, Organizator
|
||||||
from taggit.models import Tag
|
from taggit.models import Tag
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue