Merge branch 'data_migrations' of gimli.ms.mff.cuni.cz:/akce/mam/git/mamweb into data_migrations
This commit is contained in:
commit
f6895bc2e8
2 changed files with 10 additions and 16 deletions
|
@ -6,7 +6,6 @@ from django.db import models
|
||||||
from django.contrib import auth
|
from django.contrib import auth
|
||||||
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 force_text
|
from django.utils.encoding import force_text
|
||||||
from django.utils.text import slugify
|
from django.utils.text import slugify
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
@ -488,7 +487,7 @@ class Organizator(SeminarModelBase):
|
||||||
|
|
||||||
studuje = models.CharField('Studium aj.', max_length = 256,
|
studuje = models.CharField('Studium aj.', max_length = 256,
|
||||||
null = True, blank = True,
|
null = True, blank = True,
|
||||||
help_text=u"Např. 'Studuje Obecnou fyziku (Bc.), 3. ročník', "
|
help_text="Např. 'Studuje Obecnou fyziku (Bc.), 3. ročník', "
|
||||||
"'Vystudovala Diskrétní modely a algoritmy (Mgr.)' nebo "
|
"'Vystudovala Diskrétní modely a algoritmy (Mgr.)' nebo "
|
||||||
"'Přednáší na MFF'")
|
"'Přednáší na MFF'")
|
||||||
|
|
||||||
|
@ -496,7 +495,7 @@ class Organizator(SeminarModelBase):
|
||||||
null = True, blank = True)
|
null = True, blank = True)
|
||||||
|
|
||||||
skola = models.CharField('Škola, kterou studuje', max_length = 256, null=True, blank=True,
|
skola = models.CharField('Škola, kterou studuje', max_length = 256, null=True, blank=True,
|
||||||
help_text=u"Škola, např. MFF, VŠCHT, VUT, ... prostě aby se nemuselo psát do studuje"
|
help_text="Škola, např. MFF, VŠCHT, VUT, ... prostě aby se nemuselo psát do studuje"
|
||||||
"školu, ale jen obor, možnost zobrazit zvlášť")
|
"školu, ale jen obor, možnost zobrazit zvlášť")
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -642,8 +641,8 @@ class Problem(SeminarModelBase):
|
||||||
def kod_v_rocniku(self):
|
def kod_v_rocniku(self):
|
||||||
if self.stav == 'zadany':
|
if self.stav == 'zadany':
|
||||||
if self.nadproblem:
|
if self.nadproblem:
|
||||||
return force_unicode(self.nadproblem.kod_v_rocniku()+".{}".format(self.kod))
|
return self.nadproblem.kod_v_rocniku()+".{}".format(self.kod)
|
||||||
return force_unicode(str(self.kod))
|
return str(self.kod)
|
||||||
return '<Není zadaný>'
|
return '<Není zadaný>'
|
||||||
|
|
||||||
def verejne(self):
|
def verejne(self):
|
||||||
|
@ -712,7 +711,7 @@ class Clanek(Problem):
|
||||||
if self.stav == 'zadany':
|
if self.stav == 'zadany':
|
||||||
# Nemělo by být potřeba
|
# Nemělo by být potřeba
|
||||||
# if self.nadproblem:
|
# if self.nadproblem:
|
||||||
# return force_unicode(self.nadproblem.kod_v_rocniku()+".c{}".format(self.kod))
|
# return self.nadproblem.kod_v_rocniku()+".c{}".format(self.kod)
|
||||||
return "c{}".format(self.kod)
|
return "c{}".format(self.kod)
|
||||||
return '<Není zadaný>'
|
return '<Není zadaný>'
|
||||||
|
|
||||||
|
@ -913,7 +912,7 @@ class PrilohaReseni(SeminarModelBase):
|
||||||
|
|
||||||
|
|
||||||
class Pohadka(SeminarModelBase):
|
class Pohadka(SeminarModelBase):
|
||||||
u"""Kus pohádky před/za úlohou v čísle"""
|
"""Kus pohádky před/za úlohou v čísle"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = 'seminar_pohadky'
|
db_table = 'seminar_pohadky'
|
||||||
|
@ -1252,7 +1251,6 @@ class TextNode(TreeNode):
|
||||||
verbose_name = 'text')
|
verbose_name = 'text')
|
||||||
|
|
||||||
## FIXME: Logiku přesunout do views.
|
## FIXME: Logiku přesunout do views.
|
||||||
#@python_2_unicode_compatible
|
|
||||||
#class VysledkyBase(SeminarModelBase):
|
#class VysledkyBase(SeminarModelBase):
|
||||||
#
|
#
|
||||||
# class Meta:
|
# class Meta:
|
||||||
|
@ -1275,8 +1273,8 @@ class TextNode(TreeNode):
|
||||||
# verbose_name='body za číslo')
|
# verbose_name='body za číslo')
|
||||||
#
|
#
|
||||||
# def __str__(self):
|
# def __str__(self):
|
||||||
# return force_unicode(u"%s: %sb (%s)".format(self.resitel.plne_jmeno(), self.body,
|
# return "%s: %sb (%s)".format(self.resitel.plne_jmeno(), self.body,
|
||||||
# str(self.cislo)))
|
# str(self.cislo))
|
||||||
# # NOTE: DB zatez pri vypisu (ale nepouzivany)
|
# # NOTE: DB zatez pri vypisu (ale nepouzivany)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1314,7 +1312,6 @@ class TextNode(TreeNode):
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
## FIXME: Logiku přesunout do views.
|
## FIXME: Logiku přesunout do views.
|
||||||
#@python_2_unicode_compatible
|
|
||||||
#class VysledkyCelkemKCislu(VysledkyBase):
|
#class VysledkyCelkemKCislu(VysledkyBase):
|
||||||
#
|
#
|
||||||
# class Meta:
|
# class Meta:
|
||||||
|
@ -1327,12 +1324,11 @@ class TextNode(TreeNode):
|
||||||
#
|
#
|
||||||
# def __str__(self):
|
# def __str__(self):
|
||||||
# # NOTE: DB HOG (ale nepouzivany)
|
# # NOTE: DB HOG (ale nepouzivany)
|
||||||
# return force_unicode(u"%s: %sb / %sb (do %s)" % (self.resitel.plne_jmeno(), self.body, self.body_celkem, str(self.cislo)))
|
# return "%s: %sb / %sb (do %s)" % (self.resitel.plne_jmeno(), self.body, self.body_celkem, str(self.cislo))
|
||||||
##mozna potreba upravit
|
##mozna potreba upravit
|
||||||
|
|
||||||
|
|
||||||
@reversion.register(ignore_duplicates=True)
|
@reversion.register(ignore_duplicates=True)
|
||||||
@python_2_unicode_compatible
|
|
||||||
class Nastaveni(SingletonModel):
|
class Nastaveni(SingletonModel):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -1356,7 +1352,6 @@ class Nastaveni(SingletonModel):
|
||||||
|
|
||||||
|
|
||||||
@reversion.register(ignore_duplicates=True)
|
@reversion.register(ignore_duplicates=True)
|
||||||
@python_2_unicode_compatible
|
|
||||||
class Novinky(models.Model):
|
class Novinky(models.Model):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
@ -14,7 +14,6 @@ from django.contrib.auth import authenticate, login
|
||||||
from .models import Problem, Cislo, Reseni, Nastaveni, Rocnik, Soustredeni, Organizator, Resitel, Novinky, Soustredeni_Ucastnici, Pohadka, Tema, Clanek
|
from .models import Problem, Cislo, Reseni, Nastaveni, Rocnik, Soustredeni, Organizator, Resitel, Novinky, Soustredeni_Ucastnici, Pohadka, Tema, Clanek
|
||||||
#from .models import VysledkyZaCislo, VysledkyKCisluZaRocnik, VysledkyKCisluOdjakziva
|
#from .models import VysledkyZaCislo, VysledkyKCisluZaRocnik, VysledkyKCisluOdjakziva
|
||||||
from . import utils
|
from . import utils
|
||||||
from .unicodecsv import UnicodeWriter
|
|
||||||
from .forms import NameForm
|
from .forms import NameForm
|
||||||
|
|
||||||
from datetime import timedelta, date, datetime
|
from datetime import timedelta, date, datetime
|
||||||
|
@ -629,7 +628,7 @@ def soustredeniUcastniciExportView(request,soustredeni):
|
||||||
response = HttpResponse(content_type='text/csv')
|
response = HttpResponse(content_type='text/csv')
|
||||||
response['Content-Disposition'] = 'attachment; filename="ucastnici.csv"'
|
response['Content-Disposition'] = 'attachment; filename="ucastnici.csv"'
|
||||||
|
|
||||||
writer = UnicodeWriter(response)
|
writer = csv.writer(response)
|
||||||
writer.writerow(["jmeno", "prijmeni", "rok_maturity", "telefon", "email", "ulice", "mesto", "psc","stat"])
|
writer.writerow(["jmeno", "prijmeni", "rok_maturity", "telefon", "email", "ulice", "mesto", "psc","stat"])
|
||||||
for u in ucastnici:
|
for u in ucastnici:
|
||||||
writer.writerow([u.jmeno, u.prijmeni, str(u.rok_maturity), u.telefon, u.email, u.ulice, u.mesto, u.psc, u.stat.name])
|
writer.writerow([u.jmeno, u.prijmeni, str(u.rok_maturity), u.telefon, u.email, u.ulice, u.mesto, u.psc, u.stat.name])
|
||||||
|
|
Loading…
Reference in a new issue