Browse Source

Merge branch 'data_migrations' of gimli.ms.mff.cuni.cz:/akce/mam/git/mamweb into data_migrations

export_seznamu_prednasek
Tomáš Domes 6 years ago
parent
commit
2316530542
  1. 6
      galerie/migrations/0001_initial.py
  2. 2
      galerie/migrations/0004_nepovinna_galerie_u_obrazku.py
  3. 71
      galerie/migrations/0008_auto_20190430_2340.py
  4. 31
      galerie/migrations/0009_auto_20190610_2358.py
  5. 8
      galerie/models.py
  6. 2
      korektury/migrations/0001_initial.py
  7. 2
      korektury/migrations/0002_auto_20151202_2351.py
  8. 2
      korektury/migrations/0006_oprava_pdf.py
  9. 4
      korektury/migrations/0010_Pridani_odkazu_na_organizatora.py
  10. 10
      korektury/migrations/0014_add_org_to_pdf.py
  11. 2
      korektury/migrations/0015_auto_20161004_2005.py
  12. 77
      korektury/migrations/0016_auto_20190430_2340.py
  13. 36
      korektury/migrations/0017_auto_20190610_2358.py
  14. 13
      korektury/models.py
  15. 8
      korektury/views.py
  16. 7
      mamweb/settings_common.py
  17. 2
      mamweb/settings_local.py
  18. 18
      mamweb/urls.py
  19. 21
      mamweb/wsgi.py
  20. 4
      prednasky/migrations/0001_initial.py
  21. 2
      prednasky/migrations/0002_auto_20160417_2347.py
  22. 2
      prednasky/migrations/0003_auto_20160929_0117.py
  23. 6
      prednasky/migrations/0005_auto_20160929_0153.py
  24. 2
      prednasky/migrations/0006_hlasovani_seznam.py
  25. 40
      prednasky/migrations/0011_auto_20190430_2340.py
  26. 31
      prednasky/migrations/0012_auto_20190610_2358.py
  27. 9
      prednasky/models.py
  28. 44
      requirements.txt
  29. 2
      seminar/admin.py
  30. 2
      seminar/export.py
  31. 28
      seminar/migrations/0001_initial.py
  32. 2
      seminar/migrations/0005_alter_problem_autor.py
  33. 4
      seminar/migrations/0013_soustredeni_ucastnici_through_model.py
  34. 2
      seminar/migrations/0023_add_novinky.py
  35. 2
      seminar/migrations/0024_add_organizator.py
  36. 4
      seminar/migrations/0036_add_org_to_soustredeni.py
  37. 4
      seminar/migrations/0037_prispevek.py
  38. 4
      seminar/migrations/0039_pohadka.py
  39. 2
      seminar/migrations/0040_pohadka_nepovinny_autor.py
  40. 5
      seminar/migrations/0041_konfery.py
  41. 162
      seminar/migrations/0064_auto_20190610_2358.py
  42. 93
      seminar/models.py
  43. 2
      seminar/templatetags/mam_menu.py
  44. 55
      seminar/testutils.py
  45. 74
      seminar/urls.py
  46. 2
      seminar/views.py

6
galerie/migrations/0001_initial.py

@ -21,8 +21,8 @@ class Migration(migrations.Migration):
('datum_zmeny', models.DateTimeField(auto_now=True, verbose_name=b'Datum posledn\xc3\xad zm\xc4\x9bny')),
('popis', models.TextField(null=True, verbose_name=b'Popis', blank=True)),
('zobrazit', models.IntegerField(default=1, verbose_name=b'Zobrazit?', choices=[(0, b'V\xc5\xbedy'), (1, b'Organiz\xc3\xa1tor\xc5\xafm'), (2, b'Nikdy')])),
('galerie_up', models.ForeignKey(blank=True, to='galerie.Galerie', null=True)),
('soustredeni', models.ForeignKey(blank=True, to='seminar.Soustredeni', null=True)),
('galerie_up', models.ForeignKey(blank=True, to='galerie.Galerie', null=True, on_delete=models.CASCADE)),
('soustredeni', models.ForeignKey(blank=True, to='seminar.Soustredeni', null=True, on_delete=models.CASCADE)),
],
options={
'verbose_name': 'Galerie',
@ -42,7 +42,7 @@ class Migration(migrations.Migration):
('datum_vlozeni', models.DateTimeField(auto_now_add=True, verbose_name=b'Datum vlo\xc5\xbeen\xc3\xad')),
('datum', models.DateTimeField(verbose_name=b'Datum po\xc5\x99\xc3\xadzen\xc3\xad fotografie')),
('poradi', models.IntegerField(null=True, verbose_name=b'Po\xc5\x99ad\xc3\xad', blank=True)),
('galerie', models.ForeignKey(to='galerie.Galerie')),
('galerie', models.ForeignKey(to='galerie.Galerie', on_delete=models.CASCADE)),
],
options={
'verbose_name': 'Obr\xe1zek',

2
galerie/migrations/0004_nepovinna_galerie_u_obrazku.py

@ -14,7 +14,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='obrazek',
name='galerie',
field=models.ForeignKey(blank=True, to='galerie.Galerie', null=True),
field=models.ForeignKey(blank=True, to='galerie.Galerie', null=True, on_delete=models.CASCADE),
preserve_default=True,
),
]

71
galerie/migrations/0008_auto_20190430_2340.py

@ -0,0 +1,71 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-04-30 21:40
from __future__ import unicode_literals
from django.db import migrations, models
import galerie.models
class Migration(migrations.Migration):
dependencies = [
('galerie', '0007_obrazek_odstranen_datum'),
]
operations = [
migrations.AlterField(
model_name='galerie',
name='datum_vytvoreni',
field=models.DateTimeField(auto_now_add=True, verbose_name='Datum vytvoření'),
),
migrations.AlterField(
model_name='galerie',
name='datum_zmeny',
field=models.DateTimeField(auto_now=True, verbose_name='Datum poslední změny'),
),
migrations.AlterField(
model_name='galerie',
name='nazev',
field=models.CharField(max_length=100, verbose_name='Název'),
),
migrations.AlterField(
model_name='galerie',
name='popis',
field=models.TextField(blank=True, null=True, verbose_name='Popis'),
),
migrations.AlterField(
model_name='galerie',
name='poradi',
field=models.IntegerField(blank=True, null=True, verbose_name='Pořadí'),
),
migrations.AlterField(
model_name='galerie',
name='zobrazit',
field=models.IntegerField(choices=[(0, 'Vždy'), (1, 'Organizátorům'), (2, 'Nikdy')], default=1, verbose_name='Zobrazit?'),
),
migrations.AlterField(
model_name='obrazek',
name='datum_vlozeni',
field=models.DateTimeField(auto_now_add=True, verbose_name='Datum vložení'),
),
migrations.AlterField(
model_name='obrazek',
name='nazev',
field=models.CharField(blank=True, max_length=50, null=True, verbose_name='Název'),
),
migrations.AlterField(
model_name='obrazek',
name='obrazek_velky',
field=models.ImageField(help_text='Lze vložit libovolně velký obrázek. Ideální je, aby alespoň jeden rozměr měl alespoň 500px.', upload_to=galerie.models.obrazek_filename),
),
migrations.AlterField(
model_name='obrazek',
name='popis',
field=models.TextField(blank=True, null=True, verbose_name='Popis'),
),
migrations.AlterField(
model_name='obrazek',
name='poradi',
field=models.IntegerField(blank=True, null=True, verbose_name='Pořadí'),
),
]

31
galerie/migrations/0009_auto_20190610_2358.py

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.21 on 2019-06-10 21:58
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('galerie', '0008_auto_20190430_2340'),
]
operations = [
migrations.AlterField(
model_name='galerie',
name='galerie_up',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='galerie.Galerie'),
),
migrations.AlterField(
model_name='galerie',
name='soustredeni',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Soustredeni'),
),
migrations.AlterField(
model_name='obrazek',
name='galerie',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='galerie.Galerie'),
),
]

8
galerie/models.py

@ -57,7 +57,7 @@ class Obrazek(models.Model):
nazev = models.CharField('Název', max_length=50, blank=True, null=True)
popis = models.TextField('Popis', blank=True, null=True)
datum_vlozeni = models.DateTimeField('Datum vložení', auto_now_add=True)
galerie = models.ForeignKey('Galerie', blank=True, null=True)
galerie = models.ForeignKey('Galerie', blank=True, null=True, on_delete=models.SET_NULL)
poradi = models.IntegerField('Pořadí', blank=True, null=True)
def __unicode__(self):
@ -88,8 +88,10 @@ class Galerie(models.Model):
popis = models.TextField('Popis', blank = True, null = True)
titulni_obrazek = models.ForeignKey(Obrazek, blank = True, null = True, related_name = "+", on_delete = models.SET_NULL)
zobrazit = models.IntegerField('Zobrazit?', default = ORG, choices = VIDITELNOST)
galerie_up = models.ForeignKey('Galerie', blank = True, null = True)
soustredeni = models.ForeignKey(Soustredeni, blank = True, null = True)
galerie_up = models.ForeignKey('Galerie', blank = True, null = True,
on_delete=models.SET_NULL)
soustredeni = models.ForeignKey(Soustredeni, blank = True, null = True,
on_delete=models.PROTECT)
poradi = models.IntegerField('Pořadí', blank = True, null = True)
def __unicode__(self):

2
korektury/migrations/0001_initial.py

@ -50,7 +50,7 @@ class Migration(migrations.Migration):
('cas', models.DateTimeField(help_text=b'\xc4\x8cas zad\xc3\xa1n\xc3\xad koment\xc3\xa1\xc5\x99e', verbose_name='\u010das koment\xe1\u0159e')),
('autor', models.TextField(help_text=b'Autor koment\xc3\xa1\xc5\x99e', verbose_name='autor koment\xe1\u0159e', blank=True)),
('text', models.TextField(help_text=b'Text koment\xc3\xa1\xc5\x99e', verbose_name='text koment\xe1\u0159e', blank=True)),
('oprava', models.ForeignKey(to='korektury.Oprava')),
('oprava', models.ForeignKey(to='korektury.Oprava', on_delete=models.CASCADE)),
],
options={
'ordering': ['cas'],

2
korektury/migrations/0002_auto_20151202_2351.py

@ -19,7 +19,7 @@ class Migration(migrations.Migration):
('cas', models.DateTimeField(default=django.utils.timezone.now, help_text=b'\xc4\x8cas zad\xc3\xa1n\xc3\xad koment\xc3\xa1\xc5\x99e', verbose_name='\u010das koment\xe1\u0159e')),
('autor', models.TextField(help_text=b'Autor koment\xc3\xa1\xc5\x99e', verbose_name='autor koment\xe1\u0159e', blank=True)),
('text', models.TextField(help_text=b'Text koment\xc3\xa1\xc5\x99e', verbose_name='text koment\xe1\u0159e', blank=True)),
('oprava', models.ForeignKey(to='korektury.Oprava')),
('oprava', models.ForeignKey(to='korektury.Oprava', on_delete=models.CASCADE)),
],
options={
'ordering': ['cas'],

2
korektury/migrations/0006_oprava_pdf.py

@ -14,7 +14,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='oprava',
name='pdf',
field=models.ForeignKey(default=-1, to='korektury.KorekturovanePDF'),
field=models.ForeignKey(default=-1, to='korektury.KorekturovanePDF', on_delete=models.CASCADE),
preserve_default=True,
),
]

4
korektury/migrations/0010_Pridani_odkazu_na_organizatora.py

@ -15,11 +15,11 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='komentar',
name='autor_org',
field=models.ForeignKey(blank=True, to='seminar.Organizator', help_text='Autor koment\xe1\u0159e', null=True),
field=models.ForeignKey(blank=True, to='seminar.Organizator', help_text='Autor koment\xe1\u0159e', null=True, on_delete=models.CASCADE),
),
migrations.AddField(
model_name='oprava',
name='autor_org',
field=models.ForeignKey(blank=True, to='seminar.Organizator', help_text=b'Autor opravy', null=True),
field=models.ForeignKey(blank=True, to='seminar.Organizator', help_text=b'Autor opravy', null=True, on_delete=models.CASCADE),
),
]

10
korektury/migrations/0014_add_org_to_pdf.py

@ -16,10 +16,10 @@ class Migration(migrations.Migration):
model_name='korekturovanepdf',
name='org',
field=models.ForeignKey(default=None,
blank=True,
to='seminar.Organizator',
help_text=b'Zodpov\xc4\x9bdn\xc3\xbd\
organiz\xc3\xa1tor za obsah',
null=True),
blank=True,
to='seminar.Organizator',
help_text=b'Zodpov\xc4\x9bdn\xc3\xbd\
organiz\xc3\xa1tor za obsah',
null=True, on_delete=models.CASCADE),
),
]

2
korektury/migrations/0015_auto_20161004_2005.py

@ -14,6 +14,6 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='korekturovanepdf',
name='org',
field=models.ForeignKey(default=None, blank=True, to='seminar.Organizator', help_text=b'Zodpov\xc4\x9bdn\xc3\xbd organiz\xc3\xa1tor za obsah', null=True),
field=models.ForeignKey(default=None, blank=True, to='seminar.Organizator', help_text=b'Zodpov\xc4\x9bdn\xc3\xbd organiz\xc3\xa1tor za obsah', null=True, on_delete=models.CASCADE),
),
]

77
korektury/migrations/0016_auto_20190430_2340.py

@ -0,0 +1,77 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-04-30 21:40
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('korektury', '0015_auto_20161004_2005'),
]
operations = [
migrations.AlterField(
model_name='komentar',
name='cas',
field=models.DateTimeField(default=django.utils.timezone.now, help_text='Čas zadání komentáře', verbose_name='čas komentáře'),
),
migrations.AlterField(
model_name='komentar',
name='text',
field=models.TextField(blank=True, help_text='Text komentáře', verbose_name='text komentáře'),
),
migrations.AlterField(
model_name='korekturovanepdf',
name='cas',
field=models.DateTimeField(default=django.utils.timezone.now, help_text='Čas vložení PDF', verbose_name='čas vložení PDF'),
),
migrations.AlterField(
model_name='korekturovanepdf',
name='komentar',
field=models.TextField(blank=True, help_text='Komentář ke korekturovanému PDF (např. na co se zaměřit)', verbose_name='komentář k PDF'),
),
migrations.AlterField(
model_name='korekturovanepdf',
name='nazev',
field=models.CharField(blank=True, help_text='Název (např. 22.1 verze 4) korekturovaného PDF', max_length=50, verbose_name='název PDF'),
),
migrations.AlterField(
model_name='korekturovanepdf',
name='org',
field=models.ForeignKey(blank=True, default=None, help_text='Zodpovědný organizátor za obsah', null=True, on_delete=django.db.models.deletion.CASCADE, to='seminar.Organizator'),
),
migrations.AlterField(
model_name='korekturovanepdf',
name='status',
field=models.CharField(choices=[('pridavani', 'Přidávání korektur'), ('zanaseni', 'Korektury jsou zanášeny'), ('zastarale', 'Stará verze, nekorigovat')], default='pridavani', max_length=16, verbose_name='stav PDF'),
),
migrations.AlterField(
model_name='korekturovanepdf',
name='stran',
field=models.IntegerField(default=0, help_text='Počet stran PDF', verbose_name='počet stran'),
),
migrations.AlterField(
model_name='oprava',
name='autor',
field=models.ForeignKey(blank=True, help_text='Autor opravy', null=True, on_delete=django.db.models.deletion.CASCADE, to='seminar.Organizator'),
),
migrations.AlterField(
model_name='oprava',
name='status',
field=models.CharField(choices=[('k_oprave', 'K opravě'), ('opraveno', 'Opraveno'), ('neni_chyba', 'Není chyba'), ('k_zaneseni', 'K zanesení do TeXu')], default='k_oprave', max_length=16, verbose_name='stav opravy'),
),
migrations.AlterField(
model_name='oprava',
name='strana',
field=models.IntegerField(help_text='Strana s opravou (od 0)', verbose_name='strana s opravou'),
),
migrations.AlterField(
model_name='oprava',
name='text',
field=models.TextField(blank=True, help_text='Text opravy', verbose_name='text opravy'),
),
]

36
korektury/migrations/0017_auto_20190610_2358.py

@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.21 on 2019-06-10 21:58
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('korektury', '0016_auto_20190430_2340'),
]
operations = [
migrations.AlterField(
model_name='komentar',
name='autor',
field=models.ForeignKey(blank=True, help_text='Autor komentáře', null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.Organizator'),
),
migrations.AlterField(
model_name='korekturovanepdf',
name='org',
field=models.ForeignKey(blank=True, default=None, help_text='Zodpovědný organizátor za obsah', null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.Organizator'),
),
migrations.AlterField(
model_name='oprava',
name='autor',
field=models.ForeignKey(blank=True, help_text='Autor opravy', null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.Organizator'),
),
migrations.AlterField(
model_name='oprava',
name='pdf',
field=models.ForeignKey(default=-1, on_delete=django.db.models.deletion.PROTECT, to='korektury.KorekturovanePDF'),
),
]

13
korektury/models.py

@ -49,9 +49,8 @@ class KorekturovanePDF(models.Model):
pdf = models.FileField(u'PDF', upload_to = generate_filename)
org = models.ForeignKey(Organizator, blank=True,
help_text='Zodpovědný organizátor za obsah',
null=True,
default=None)
help_text='Zodpovědný organizátor za obsah',
null=True, default=None, on_delete=models.SET_NULL)
stran = models.IntegerField(u'počet stran', help_text='Počet stran PDF',
default=0)
@ -124,7 +123,7 @@ class Oprava(models.Model):
#Interní ID
id = models.AutoField(primary_key = True)
pdf = models.ForeignKey(KorekturovanePDF, default=-1)
pdf = models.ForeignKey(KorekturovanePDF, default=-1, on_delete=models.PROTECT)
strana = models.IntegerField(u'strana s opravou', help_text='Strana s opravou (od 0)')
@ -146,7 +145,7 @@ class Oprava(models.Model):
autor = models.ForeignKey(Organizator, blank = True,
help_text='Autor opravy',
null = True)
null = True, on_delete=models.SET_NULL)
text = models.TextField(u'text opravy',blank = True, help_text='Text opravy')
@ -173,10 +172,10 @@ class Komentar(models.Model):
cas = models.DateTimeField(u'čas komentáře',default=timezone.now,help_text = 'Čas zadání komentáře')
oprava = models.ForeignKey(Oprava)
oprava = models.ForeignKey(Oprava, on_delete=models.CASCADE)
autor = models.ForeignKey(Organizator, blank = True,
help_text = u'Autor komentáře',
null = True)
null = True, on_delete=models.SET_NULL)
text = models.TextField(u'text komentáře',blank = True, help_text='Text komentáře')

8
korektury/views.py

@ -23,10 +23,10 @@ class KorekturyListView(generic.ListView):
model = KorekturovanePDF
# Nefunguje, filtry se vubec nepouziji
queryset = KorekturovanePDF.objects.annotate(
k_oprave_cnt=Count('oprava',filter=Q(oprava__status='k_oprave')),
opraveno_cnt=Count('oprava',filter=Q(oprava__status='opraveno')),
neni_chyba_cnt=Count('oprava',filter=Q(oprava__status='neni_chyba')),
k_zaneseni_cnt=Count('oprava',filter=Q(oprava__status='k_zaneseni')),
k_oprave_cnt=Count('oprava',distinct=True,filter=Q(oprava__status='k_oprave')),
opraveno_cnt=Count('oprava',distinct=True,filter=Q(oprava__status='opraveno')),
neni_chyba_cnt=Count('oprava',distinct=True,filter=Q(oprava__status='neni_chyba')),
k_zaneseni_cnt=Count('oprava',distinct=True,filter=Q(oprava__status='k_zaneseni')),
)
template_name = 'korektury/seznam.html'

7
mamweb/settings_common.py

@ -52,14 +52,15 @@ AUTHENTICATION_BACKENDS = (
)
MIDDLEWARE_CLASSES = (
MIDDLEWARE = (
'reversion.middleware.RevisionMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'mamweb.middleware.LoggedInHintCookieMiddleware',
# FIXME: rozbilo se při přechodu na Django 2.0, nevím, jestli
# se to dá zahodit bez náhrady
# 'mamweb.middleware.LoggedInHintCookieMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',

2
mamweb/settings_local.py

@ -10,7 +10,7 @@ import os.path
# Import common settings
from .settings_common import *
MIDDLEWARE_CLASSES += (
MIDDLEWARE += (
'debug_toolbar.middleware.DebugToolbarMiddleware',
)

18
mamweb/urls.py

@ -9,29 +9,29 @@ from django import views
urlpatterns = [
# Admin a nastroje
url(r'^admin/', include(admin.site.urls)), # NOQA
url(r'^ckeditor/', include('ckeditor_uploader.urls')),
url(r'^autocomplete/', include('autocomplete_light.urls')),
url('admin/', admin.site.urls), # NOQA
url('ckeditor/', include('ckeditor_uploader.urls')),
url('autocomplete/', include('autocomplete_light.urls')),
# Seminarova aplikace (ma vlastni podadresare)
url(r'^', include('seminar.urls')),
url('', include('seminar.urls')),
# Korekturovaci aplikace (ma vlastni podadresare)
url(r'^', include('korektury.urls')),
url('', include('korektury.urls')),
# Prednaskova aplikace (ma vlastni podadresare)
url(r'^', include('prednasky.urls')),
url('', include('prednasky.urls')),
# Comments (interni i verejne)
url(r'^comments_dj/', include('django_comments.urls')),
url(r'^comments_fl/', include('fluent_comments.urls')),
url('comments_dj/', include('django_comments.urls')),
url('comments_fl/', include('fluent_comments.urls')),
]
# This is only needed when using runserver.
if settings.DEBUG:
urlpatterns += [
url(r'^media/(?P<path>.*)$', views.static.serve, # NOQA
url('media/<str:path>', views.static.serve, # NOQA
{'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
]
urlpatterns += staticfiles_urlpatterns()

21
mamweb/wsgi.py

@ -4,25 +4,14 @@ WSGI config for mamweb project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""
import sys, os, os.path, traceback, time, signal
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mamweb.settings")
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'lib', 'python2.7', 'site-packages')))
import os
from django.core.wsgi import get_wsgi_application
try:
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mamweb.settings")
except Exception:
print('handling WSGI exception')
# Error loading applications
if 'mod_wsgi' in sys.modules:
traceback.print_exc()
os.kill(os.getpid(), signal.SIGINT)
time.sleep(2)
application = get_wsgi_application()

4
prednasky/migrations/0001_initial.py

@ -28,7 +28,7 @@ class Migration(migrations.Migration):
('obtiznost', models.IntegerField(verbose_name=b'Obt\xc3\xad\xc5\xbenost', choices=[(1, b'Lehk\xc3\xa1'), (2, b'St\xc5\x99edn\xc3\xad'), (3, b'T\xc4\x9b\xc5\xbek\xc3\xa1')])),
('obor', models.CharField(max_length=5, verbose_name=b'Obor')),
('klicova', models.CharField(max_length=200, null=True, verbose_name=b'Kl\xc3\xad\xc4\x8dov\xc3\xa1 slova', blank=True)),
('org', models.ForeignKey(to='seminar.Organizator')),
('org', models.ForeignKey(to='seminar.Organizator', on_delete=models.CASCADE)),
],
),
migrations.CreateModel(
@ -40,6 +40,6 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='hlasovani',
name='prednaska',
field=models.ForeignKey(to='prednasky.Prednaska'),
field=models.ForeignKey(to='prednasky.Prednaska', on_delete=models.CASCADE),
),
]

2
prednasky/migrations/0002_auto_20160417_2347.py

@ -14,7 +14,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='prednaska',
name='seznam',
field=models.ForeignKey(default=None, blank=True, to='prednasky.Seznam'),
field=models.ForeignKey(default=None, blank=True, to='prednasky.Seznam', on_delete=models.CASCADE),
),
migrations.AlterField(
model_name='hlasovani',

2
prednasky/migrations/0003_auto_20160929_0117.py

@ -51,7 +51,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='prednaska',
name='seznam',
field=models.ForeignKey(to='prednasky.Seznam_old'),
field=models.ForeignKey(to='prednasky.Seznam_old',on_delete=models.CASCADE),
),
migrations.AlterModelTable(
name='hlasovani',

6
prednasky/migrations/0005_auto_20160929_0153.py

@ -16,7 +16,7 @@ class Migration(migrations.Migration):
name='Prednaska_Seznam',
fields=[
('id', models.AutoField(serialize=False, primary_key=True)),
('prednaska', models.ForeignKey(to='prednasky.Prednaska')),
('prednaska', models.ForeignKey(to='prednasky.Prednaska', on_delete=models.CASCADE)),
],
options={
'db_table': 'prednasky_prednaska_seznam',
@ -29,7 +29,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(serialize=False, primary_key=True)),
('stav', models.IntegerField(default=2, verbose_name=b'Stav', choices=[(1, b'N\xc3\xa1vrh'), (2, b'Bude')])),
('soustredeni', models.ForeignKey(default=None, to='seminar.Soustredeni', null=True)),
('soustredeni', models.ForeignKey(default=None, to='seminar.Soustredeni', null=True, on_delete=models.CASCADE)),
],
options={
'ordering': ['soustredeni', 'stav'],
@ -44,6 +44,6 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='prednaska_seznam',
name='seznam',
field=models.ForeignKey(to='prednasky.Seznam'),
field=models.ForeignKey(to='prednasky.Seznam', on_delete=models.CASCADE),
),
]

2
prednasky/migrations/0006_hlasovani_seznam.py

@ -14,7 +14,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='hlasovani',
name='seznam',
field=models.ForeignKey(default=1, to='prednasky.Seznam'),
field=models.ForeignKey(default=1, to='prednasky.Seznam', on_delete=models.CASCADE),
preserve_default=False,
),
]

40
prednasky/migrations/0011_auto_20190430_2340.py

@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-04-30 21:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('prednasky', '0010_auto_20160929_0508'),
]
operations = [
migrations.AlterField(
model_name='hlasovani',
name='body',
field=models.IntegerField(choices=[(-1, '-1'), (0, '0'), (1, '1')], default=0, verbose_name='Body'),
),
migrations.AlterField(
model_name='hlasovani',
name='ucastnik',
field=models.CharField(max_length=100, verbose_name='Účastník'),
),
migrations.AlterField(
model_name='prednaska',
name='anotace',
field=models.TextField(blank=True, help_text='Veřejná anotace v hlasování', null=True, verbose_name='Anotace'),
),
migrations.AlterField(
model_name='prednaska',
name='obtiznost',
field=models.IntegerField(choices=[(1, 'Lehká'), (2, 'Střední'), (3, 'Těžká')], verbose_name='Obtížnost'),
),
migrations.AlterField(
model_name='seznam',
name='stav',
field=models.IntegerField(choices=[(1, 'Návrh'), (2, 'Bude')], default=1, verbose_name='Stav'),
),
]

31
prednasky/migrations/0012_auto_20190610_2358.py

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.21 on 2019-06-10 21:58
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('prednasky', '0011_auto_20190430_2340'),
]
operations = [
migrations.AlterField(
model_name='hlasovani',
name='seznam',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='prednasky.Seznam'),
),
migrations.AlterField(
model_name='prednaska',
name='org',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Organizator'),
),
migrations.AlterField(
model_name='seznam',
name='soustredeni',
field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Soustredeni'),
),
]

9
prednasky/models.py

@ -25,7 +25,8 @@ class Seznam(models.Model):
ordering = ['soustredeni', 'stav']
id = models.AutoField(primary_key = True)
soustredeni = models.ForeignKey(Soustredeni,null = True, default = None)
soustredeni = models.ForeignKey(Soustredeni,null = True, default = None,
on_delete=models.PROTECT)
stav = models.IntegerField('Stav',choices=STAV_CHOICES,default = STAV_NAVRH)
def __str__(self):
@ -55,7 +56,7 @@ class Prednaska(models.Model):
id = models.AutoField(primary_key = True)
nazev = models.CharField('Název', max_length = 300)
org = models.ForeignKey(Organizator)
org = models.ForeignKey(Organizator, on_delete=models.PROTECT)
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 = 'Veřejná anotace v hlasování')
obtiznost = models.IntegerField('Obtížnost', choices=CHOICES_OBTIZNOST)
@ -75,10 +76,10 @@ class Hlasovani(models.Model):
verbose_name_plural = 'Hlasování'
ordering = ['ucastnik', 'prednaska']
id = models.AutoField(primary_key = True)
prednaska = models.ForeignKey(Prednaska)
prednaska = models.ForeignKey(Prednaska, on_delete=models.CASCADE)
body = models.IntegerField('Body', default = 0, choices = CHOICES_BODY)
ucastnik = models.CharField('Účastník', max_length = 100)
seznam = models.ForeignKey(Seznam)
seznam = models.ForeignKey(Seznam,null=True,on_delete=models.SET_NULL)
def __str__(self):
return force_unicode("{} dal {} bodů {} v seznamu {}".format(self.ucastnik,

44
requirements.txt

@ -1,30 +1,30 @@
# basic libs
psycopg2==2.7.5
html5lib==1.0.1
ipython==5.8.0
Pillow==5.2.0
pytz==2018.5
six==1.10.0
pexpect==4.6.0
traitlets==4.3.2
Unidecode==1.0.22
psycopg2
html5lib
ipython
Pillow
pytz
six
pexpect
traitlets
Unidecode
# Django and modules
Django>=1.11.17,<2.0
Django<2.3
#django-bootstrap-sass
django-mptt==0.9.1
django-reversion==2.0.13
django-sekizai==0.10.0
django-countries==5.3.1
django-solo==1.1.3
django-ckeditor==5.6.1
django-flat-theme==1.1.4
django-taggit==0.23.0
django-mptt
django-reversion
django-sekizai
django-countries
django-solo
django-ckeditor
django-flat-theme
django-taggit
django-autocomplete-light==2.3.6
django-crispy-forms==1.7.2
django-imagekit==4.0.2
django-crispy-forms
django-imagekit
# Comments
akismet==1.0.1
@ -49,3 +49,7 @@ Werkzeug==0.14.1
# uWSGI
uWSGI==2.0.17.1
# Potřeba pro test data
lorem

2
seminar/admin.py

@ -9,7 +9,7 @@ from ckeditor_uploader.widgets import CKEditorUploadingWidget
from django.db.models import Count
from django.db import models
from django.utils.safestring import mark_safe
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.contrib.auth.models import User

2
seminar/export.py

@ -1,7 +1,7 @@
import datetime, django
from django.shortcuts import get_object_or_404, render
from django.http import HttpResponse
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.views import generic
from django.utils.encoding import force_text

28
seminar/migrations/0001_initial.py

@ -63,7 +63,7 @@ class Migration(migrations.Migration):
name='Nastaveni',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('aktualni_cislo', models.ForeignKey(verbose_name='posledn\xed vydan\xe9 \u010d\xedslo', to='seminar.Cislo')),
('aktualni_cislo', models.ForeignKey(verbose_name='posledn\xed vydan\xe9 \u010d\xedslo', to='seminar.Cislo', on_delete=models.CASCADE)),
],
options={
'db_table': 'seminar_nastaveni',
@ -98,10 +98,10 @@ class Migration(migrations.Migration):
('text_problemu', models.TextField(verbose_name='ve\u0159ejn\xfd text zad\xe1n\xed a \u0159e\u0161en\xed', blank=True)),
('kod', models.CharField(default=b'', help_text='\u010c\xedslo/k\xf3d \xfalohy v \u010d\xedsle nebo k\xf3d t\xe9matu/\u010dl\xe1nku/seri\xe1lu v ro\u010dn\xedku', max_length=32, verbose_name='lok\xe1ln\xed k\xf3d', blank=True)),
('body', models.IntegerField(null=True, verbose_name='maximum bod\u016f', blank=True)),
('autor', models.ForeignKey(related_name='autor_uloh', verbose_name='autor probl\xe9mu', to=settings.AUTH_USER_MODEL)),
('cislo_reseni', models.ForeignKey(related_name='resene_problemy', blank=True, to='seminar.Cislo', help_text='\u010c\xedslo s \u0159e\u0161en\xedm \xfalohy, jen pro \xfalohy', null=True, verbose_name='\u010d\xedslo \u0159e\u0161en\xed')),
('cislo_zadani', models.ForeignKey(related_name='zadane_problemy', verbose_name='\u010d\xedslo zad\xe1n\xed', blank=True, to='seminar.Cislo', null=True)),
('opravovatel', models.ForeignKey(related_name='opravovatel_uloh', verbose_name='opravovatel', blank=True, to=settings.AUTH_USER_MODEL, null=True)),
('autor', models.ForeignKey(related_name='autor_uloh', verbose_name='autor probl\xe9mu', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)),
('cislo_reseni', models.ForeignKey(related_name='resene_problemy', blank=True, to='seminar.Cislo', help_text='\u010c\xedslo s \u0159e\u0161en\xedm \xfalohy, jen pro \xfalohy', null=True, verbose_name='\u010d\xedslo \u0159e\u0161en\xed', on_delete=models.CASCADE)),
('cislo_zadani', models.ForeignKey(related_name='zadane_problemy', verbose_name='\u010d\xedslo zad\xe1n\xed', blank=True, to='seminar.Cislo', null=True, on_delete=models.CASCADE)),
('opravovatel', models.ForeignKey(related_name='opravovatel_uloh', verbose_name='opravovatel', blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.CASCADE)),
],
options={
'db_table': 'seminar_problemy',
@ -117,8 +117,8 @@ class Migration(migrations.Migration):
('body', models.IntegerField(null=True, verbose_name='body', blank=True)),
('timestamp', models.DateTimeField(auto_now=True, verbose_name='vytvo\u0159eno')),
('poznamka', models.TextField(help_text='Neve\u0159ejn\xe1 pozn\xe1mka k \u0159e\u0161en\xed (plain text)', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True)),
('cislo_body', models.ForeignKey(related_name='bodovana_reseni', verbose_name='\u010d\xedslo pro body', blank=True, to='seminar.Cislo', null=True)),
('problem', models.ForeignKey(related_name='reseni', verbose_name='probl\xe9m', to='seminar.Problem')),
('cislo_body', models.ForeignKey(related_name='bodovana_reseni', verbose_name='\u010d\xedslo pro body', blank=True, to='seminar.Cislo', null=True, on_delete=models.CASCADE)),
('problem', models.ForeignKey(related_name='reseni', verbose_name='probl\xe9m', to='seminar.Problem', on_delete=models.CASCADE)),
],
options={
'ordering': ['problem', 'resitel'],
@ -201,7 +201,7 @@ class Migration(migrations.Migration):
('datum_konce', models.DateField(help_text='Posledn\xed den soust\u0159ed\u011bn\xed', null=True, verbose_name='datum konce', blank=True)),
('verejne_db', models.BooleanField(default=False, verbose_name='soust\u0159ed\u011bn\xed zve\u0159ejn\u011bno', db_column='verejne')),
('misto', models.CharField(default=b'', help_text='M\xedsto (n\xe1zev obce, voliteln\u011b t\xe9\u017e objektu', max_length=256, verbose_name='m\xedsto soust\u0159ed\u011bn\xed', blank=True)),
('rocnik', models.ForeignKey(related_name='soustredeni', verbose_name='ro\u010dn\xedk', to='seminar.Rocnik')),
('rocnik', models.ForeignKey(related_name='soustredeni', verbose_name='ro\u010dn\xedk', to='seminar.Rocnik', on_delete=models.CASCADE)),
('ucastnici', models.ManyToManyField(help_text='Seznam \xfa\u010dastn\xedk\u016f soust\u0159ed\u011bn\xed', to='seminar.Resitel', db_table='seminar_soustredeni_ucastnici', verbose_name='\xfa\u010dastn\xedci soust\u0159ed\u011bn\xed')),
],
options={
@ -215,37 +215,37 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='resitel',
name='skola',
field=models.ForeignKey(verbose_name='\u0161kola', blank=True, to='seminar.Skola', null=True),
field=models.ForeignKey(verbose_name='\u0161kola', blank=True, to='seminar.Skola', null=True, on_delete=models.CASCADE),
preserve_default=True,
),
migrations.AddField(
model_name='resitel',
name='user',
field=models.OneToOneField(null=True, blank=True, to=settings.AUTH_USER_MODEL, verbose_name='u\u017eivatel'),
field=models.OneToOneField(null=True, blank=True, to=settings.AUTH_USER_MODEL, verbose_name='u\u017eivatel', on_delete=models.CASCADE),
preserve_default=True,
),
migrations.AddField(
model_name='reseni',
name='resitel',
field=models.ForeignKey(related_name='reseni', verbose_name='\u0159e\u0161itel', to='seminar.Resitel'),
field=models.ForeignKey(related_name='reseni', verbose_name='\u0159e\u0161itel', to='seminar.Resitel', on_delete=models.CASCADE),
preserve_default=True,
),
migrations.AddField(
model_name='prilohareseni',
name='reseni',
field=models.ForeignKey(related_name='prilohy', verbose_name='\u0159e\u0161en\xed', to='seminar.Reseni'),
field=models.ForeignKey(related_name='prilohy', verbose_name='\u0159e\u0161en\xed', to='seminar.Reseni', on_delete=models.CASCADE),
preserve_default=True,
),
migrations.AddField(
model_name='nastaveni',
name='aktualni_rocnik',
field=models.ForeignKey(verbose_name='aktu\xe1ln\xed ro\u010dn\xedk', to='seminar.Rocnik'),
field=models.ForeignKey(verbose_name='aktu\xe1ln\xed ro\u010dn\xedk', to='seminar.Rocnik', on_delete=models.CASCADE),
preserve_default=True,
),
migrations.AddField(
model_name='cislo',
name='rocnik',
field=models.ForeignKey(related_name='cisla', verbose_name='ro\u010dn\xedk', to='seminar.Rocnik'),
field=models.ForeignKey(related_name='cisla', verbose_name='ro\u010dn\xedk', to='seminar.Rocnik', on_delete=models.CASCADE),
preserve_default=True,
),
]

2
seminar/migrations/0005_alter_problem_autor.py

@ -15,7 +15,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='problem',
name='autor',
field=models.ForeignKey(related_name='autor_uloh', verbose_name='autor probl\xe9mu', blank=True, to=settings.AUTH_USER_MODEL, null=True),
field=models.ForeignKey(related_name='autor_uloh', verbose_name='autor probl\xe9mu', blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.CASCADE),
preserve_default=True,
),
]

4
seminar/migrations/0013_soustredeni_ucastnici_through_model.py

@ -16,8 +16,8 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(serialize=False, primary_key=True)),
('poznamka', models.CharField(default=b'', help_text='Neve\u0159ejn\xe1 pozn\xe1mka k \xfa\u010dasti (plain text)', max_length=64, verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True)),
('resitel', models.ForeignKey(verbose_name='\u0159e\u0161itel', to='seminar.Resitel')),
('soustredeni', models.ForeignKey(verbose_name='soust\u0159ed\u011bn\xed', to='seminar.Soustredeni')),
('resitel', models.ForeignKey(verbose_name='\u0159e\u0161itel', to='seminar.Resitel', on_delete=models.CASCADE)),
('soustredeni', models.ForeignKey(verbose_name='soust\u0159ed\u011bn\xed', to='seminar.Soustredeni',on_delete=models.CASCADE)),
],
options={
'ordering': ['soustredeni', 'resitel'],

2
seminar/migrations/0023_add_novinky.py

@ -21,7 +21,7 @@ class Migration(migrations.Migration):
('text', models.TextField(null=True, verbose_name=b'Text novinky', blank=True)),
('obrazek', models.ImageField(upload_to=b'image_novinky/%Y/%m/%d/', null=True, verbose_name=b'Obr\xc3\xa1zek', blank=True)),
('zverejneno', models.BooleanField(default=False, verbose_name=b'Zve\xc5\x99ejn\xc4\x9bno')),
('autor', models.ForeignKey(verbose_name=b'Autor novinky', to=settings.AUTH_USER_MODEL)),
('autor', models.ForeignKey(verbose_name=b'Autor novinky', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE))
],
options={
'verbose_name': 'Novinka',

2
seminar/migrations/0024_add_organizator.py

@ -24,7 +24,7 @@ class Migration(migrations.Migration):
('strucny_popis_organizatora', models.TextField(null=True, verbose_name=b'Stru\xc4\x8dn\xc3\xbd popis organiz\xc3\xa1tora', blank=True)),
('foto', models.ImageField(help_text=b'Vlo\xc5\xbe fotografii organiz\xc3\xa1tora o libovon\xc3\xa9 velikosti', upload_to=b'image_organizatori/%Y/', null=True, verbose_name=b'Fotografie organiz\xc3\xa1tora', blank=True)),
('foto_male', models.ImageField(upload_to=b'image_organizatori/male/%Y/', null=True, editable=False, blank=True)),
('user', models.OneToOneField(verbose_name=b'Osoba', to=settings.AUTH_USER_MODEL, help_text=b'Vyber \xc3\xba\xc4\x8det sp\xc5\x99a\xc5\xbeen\xc3\xbd s organiz\xc3\xa1torem.')),
('user', models.OneToOneField(verbose_name=b'Osoba', to=settings.AUTH_USER_MODEL, help_text=b'Vyber \xc3\xba\xc4\x8det sp\xc5\x99a\xc5\xbeen\xc3\xbd s organiz\xc3\xa1torem.',on_delete=models.CASCADE)),
],
options={
'verbose_name': 'Organiz\xe1tor',

4
seminar/migrations/0036_add_org_to_soustredeni.py

@ -16,8 +16,8 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(serialize=False, primary_key=True)),
('poznamka', models.TextField(help_text='Neve\u0159ejn\xe1 pozn\xe1mka k \xfa\u010dasti organiz\xe1tora (plain text)', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True)),
('organizator', models.ForeignKey(verbose_name='organiz\xe1tor', to='seminar.Organizator')),
('soustredeni', models.ForeignKey(verbose_name='soust\u0159ed\u011bn\xed', to='seminar.Soustredeni')),
('organizator', models.ForeignKey(verbose_name='organiz\xe1tor', to='seminar.Organizator', on_delete=models.CASCADE)),
('soustredeni', models.ForeignKey(verbose_name='soust\u0159ed\u011bn\xed', to='seminar.Soustredeni', on_delete=models.CASCADE)),
],
options={
'ordering': ['soustredeni', 'organizator'],

4
seminar/migrations/0037_prispevek.py

@ -19,8 +19,8 @@ class Migration(migrations.Migration):
('text_org', models.TextField(null=True, verbose_name=b'Orgovsk\xc3\xbd text', blank=True)),
('text_resitel', models.TextField(null=True, verbose_name=b'\xc5\x98e\xc5\xa1itelsk\xc3\xbd text', blank=True)),
('zverejnit', models.BooleanField(verbose_name=b'Zve\xc5\x99ejnit?')),
('problem', models.ForeignKey(verbose_name=b'Probl\xc3\xa9m', to='seminar.Problem')),
('reseni', models.OneToOneField(null=True, blank=True, to='seminar.Reseni', verbose_name=b'\xc5\x98e\xc5\xa1en\xc3\xad')),
('problem', models.ForeignKey(verbose_name=b'Probl\xc3\xa9m', to='seminar.Problem', on_delete=models.CASCADE)),
('reseni', models.OneToOneField(null=True, blank=True, to='seminar.Reseni', verbose_name=b'\xc5\x98e\xc5\xa1en\xc3\xad', on_delete=models.CASCADE)),
],
options={
'abstract': False,

4
seminar/migrations/0039_pohadka.py

@ -21,8 +21,8 @@ class Migration(migrations.Migration):
('text', models.TextField(verbose_name='Text poh\xe1dky')),
('pred', models.BooleanField(default=True, verbose_name='P\u0159ed \xfalohou')),
('timestamp', models.DateTimeField(default=django.utils.timezone.now, verbose_name='Vytvo\u0159eno', editable=False, blank=True)),
('autor', models.ForeignKey(verbose_name=b'Autor poh\xc3\xa1dky', to=settings.AUTH_USER_MODEL)),
('uloha', models.ForeignKey(related_name='pohadky', verbose_name='\xdaloha', to='seminar.Problem')),
('autor', models.ForeignKey(verbose_name=b'Autor poh\xc3\xa1dky', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)),
('uloha', models.ForeignKey(related_name='pohadky', verbose_name='\xdaloha', to='seminar.Problem',on_delete=models.CASCADE)),
],
options={
'ordering': ['uloha__cislo_zadani', 'uloha__kod', '-pred'],

2
seminar/migrations/0040_pohadka_nepovinny_autor.py

@ -15,6 +15,6 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='pohadka',
name='autor',
field=models.ForeignKey(verbose_name=b'Autor poh\xc3\xa1dky', to=settings.AUTH_USER_MODEL, null=True),
field=models.ForeignKey(verbose_name=b'Autor poh\xc3\xa1dky', to=settings.AUTH_USER_MODEL, null=True, on_delete=models.CASCADE),
),
]

5
seminar/migrations/0041_konfery.py

@ -37,8 +37,9 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(serialize=False, primary_key=True)),
('poznamka', models.TextField(help_text='Neve\u0159ejn\xe1 pozn\xe1mka k \xfa\u010dasti (plain text)', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True)),
('konfera', models.ForeignKey(verbose_name='konfera', to='seminar.Konfera')),
('resitel', models.ForeignKey(verbose_name='\u0159e\u0161itel', to='seminar.Resitel')),
('konfera', models.ForeignKey(verbose_name='konfera', to='seminar.Konfera',
on_delete=models.PROTECT)),
('resitel', models.ForeignKey(verbose_name='\u0159e\u0161itel', to='seminar.Resitel',on_delete=models.CASCADE)),
],
options={
'ordering': ['konfera', 'resitel'],

162
seminar/migrations/0064_auto_20190610_2358.py

@ -0,0 +1,162 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.21 on 2019-06-10 21:58
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('seminar', '0063_procisteni_migraci'),
]
operations = [
migrations.AlterField(
model_name='cislo',
name='rocnik',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='cisla', to='seminar.Rocnik', verbose_name='ročník'),
),
migrations.AlterField(
model_name='clanek',
name='cislo',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Cislo', verbose_name='číslo'),
),
migrations.AlterField(
model_name='hodnoceni',
name='cislo_body',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='hodnoceni', to='seminar.Cislo', verbose_name='číslo pro body'),
),
migrations.AlterField(
model_name='hodnoceni',
name='problem',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Problem', verbose_name='problém'),
),
migrations.AlterField(
model_name='konfery_ucastnici',
name='konfera',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Konfera', verbose_name='konfera'),
),
migrations.AlterField(
model_name='konfery_ucastnici',
name='resitel',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Resitel', verbose_name='řešitel'),
),
migrations.AlterField(
model_name='nastaveni',
name='aktualni_cislo',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Cislo', verbose_name='poslední vydané číslo'),
),
migrations.AlterField(
model_name='nastaveni',
name='aktualni_rocnik',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Rocnik', verbose_name='aktuální ročník'),
),
migrations.AlterField(
model_name='novinky',
name='autor',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.Organizator', verbose_name='Autor novinky'),
),
migrations.AlterField(
model_name='organizator',
name='osoba',
field=models.OneToOneField(help_text='osobní údaje organizátora', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='org', to='seminar.Osoba', verbose_name='osoba'),
),
migrations.AlterField(
model_name='osoba',
name='user',
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL, verbose_name='uživatel'),
),
migrations.AlterField(
model_name='pohadka',
name='autor',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.Organizator', verbose_name='Autor pohádky'),
),
migrations.AlterField(
model_name='problem',
name='autor',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='autor_problemu_problem', to='seminar.Organizator', verbose_name='autor problému'),
),
migrations.AlterField(
model_name='problem',
name='garant',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='garant_problemu_problem', to='seminar.Organizator', verbose_name='garant zadaného problému'),
),
migrations.AlterField(
model_name='problem',
name='nadproblem',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='nadproblem_problem', to='seminar.Problem', verbose_name='nadřazený problém'),
),
migrations.AlterField(
model_name='reseni',
name='text_cely',
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='reseni_cely_set', to='seminar.Text', verbose_name='Plná verze textu řešení'),
),
migrations.AlterField(
model_name='reseni_resitele',
name='resitele',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Resitel', verbose_name='řešitel'),
),
migrations.AlterField(
model_name='resitel',
name='osoba',
field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.Osoba', verbose_name='osoba'),
),
migrations.AlterField(
model_name='resitel',
name='skola',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.Skola', verbose_name='škola'),
),
migrations.AlterField(
model_name='skola',
name='kontaktni_osoba',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.Osoba', verbose_name='Kontaktní osoba'),
),
migrations.AlterField(
model_name='soustredeni',
name='rocnik',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='soustredeni', to='seminar.Rocnik', verbose_name='ročník'),
),
migrations.AlterField(
model_name='soustredeni_organizatori',
name='organizator',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Organizator', verbose_name='organizátor'),
),
migrations.AlterField(
model_name='soustredeni_organizatori',
name='soustredeni',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Soustredeni', verbose_name='soustředění'),
),
migrations.AlterField(
model_name='soustredeni_ucastnici',
name='resitel',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Resitel', verbose_name='řešitel'),
),
migrations.AlterField(
model_name='soustredeni_ucastnici',
name='soustredeni',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Soustredeni', verbose_name='soustředění'),
),
migrations.AlterField(
model_name='tema',
name='rocnik',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Rocnik', verbose_name='ročník'),
),
migrations.AlterField(
model_name='uloha',
name='cislo_deadline',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='deadlinove_ulohy', to='seminar.Cislo', verbose_name='číslo deadlinu'),
),
migrations.AlterField(
model_name='uloha',
name='cislo_reseni',
field=models.ForeignKey(blank=True, help_text='Číslo s řešením úlohy, jen pro úlohy', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='resene_ulohy', to='seminar.Cislo', verbose_name='číslo řešení'),
),
migrations.AlterField(
model_name='uloha',
name='cislo_zadani',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='zadane_ulohy', to='seminar.Cislo', verbose_name='číslo zadání'),
),
]

93
seminar/models.py

@ -9,7 +9,7 @@ from django.conf import settings
from django.utils.encoding import python_2_unicode_compatible
from django.utils.encoding import force_text
from django.utils.text import slugify
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.core.cache import cache
from django.core.exceptions import ObjectDoesNotExist
from django.utils.text import get_valid_filename
@ -64,7 +64,7 @@ class Osoba(SeminarModelBase):
# User, pokud má na webu účet
user = models.OneToOneField(settings.AUTH_USER_MODEL, blank=True, null=True,
verbose_name='uživatel')
verbose_name='uživatel', on_delete=models.DO_NOTHING)
# Pohlaví. Že ho neznáme se snad nestane (a ušetří to práci při programování)
pohlavi_muz = models.BooleanField('pohlaví (muž)', default=False)
@ -185,7 +185,7 @@ class Skola(SeminarModelBase):
help_text='Neveřejná poznámka ke škole (plain text)')
kontaktni_osoba = models.ForeignKey(Osoba, verbose_name='Kontaktní osoba',
blank=True, null=True)
blank=True, null=True, on_delete=models.SET_NULL)
def __str__(self):
return '{}, {}, {}'.format(self.nazev, self.ulice, self.mesto)
@ -204,7 +204,8 @@ class Prijemce(SeminarModelBase):
help_text='Neveřejná poznámka k příemci čísel (plain text)')
osoba = models.OneToOneField(Osoba, verbose_name='komu', blank=False, null=False,
help_text='Které osobě či na jakou adresu se mají zasílat čísla')
help_text='Které osobě či na jakou adresu se mají zasílat čísla',
on_delete=models.CASCADE)
# FIXME: možná chceme něco jako vazbu na osobu XOR školu a počet kusů k zaslání
# FIXME: a možná taky posílání na mail a možná taky přes něj chceme posílat i řešitelům
@ -225,9 +226,12 @@ class Resitel(SeminarModelBase):
# Interní ID
id = models.AutoField(primary_key = True)
osoba = models.OneToOneField(Osoba, blank=False, null=True, verbose_name='osoba') # FIXME opravit po prvni migraci
osoba = models.OneToOneField(Osoba, blank=False, null=True, verbose_name='osoba',
on_delete=models.SET_NULL) # FIXME opravit po prvni migraci
skola = models.ForeignKey(Skola, blank=True, null=True, verbose_name='škola')
skola = models.ForeignKey(Skola, blank=True, null=True, verbose_name='škola',
on_delete=models.SET_NULL)
# Očekávaný rok maturity a vyřazení z aktivních řešitelů
rok_maturity = models.IntegerField('rok maturity', blank=True, null=True)
@ -387,7 +391,8 @@ class Cislo(SeminarModelBase):
# Interní ID
id = models.AutoField(primary_key = True)
rocnik = models.ForeignKey(Rocnik, verbose_name='ročník', related_name='cisla', db_index=True)
rocnik = models.ForeignKey(Rocnik, verbose_name='ročník', related_name='cisla',
db_index=True,on_delete=models.PROTECT)
cislo = models.CharField('název čísla', max_length=32, db_index=True,
help_text='Většinou jen "1", vyjímečně "7-8", lexikograficky určuje pořadí v ročníku!')
@ -467,7 +472,8 @@ class Organizator(SeminarModelBase):
# zmena dedicnosti z models.Model na SeminarModelBase, potencialni vznik bugu
osoba = models.OneToOneField(Osoba, verbose_name='osoba', related_name='org',
help_text='osobní údaje organizátora', null=True, blank=False) #FIXME opravit po migraci
help_text='osobní údaje organizátora', null=True, blank=False,
on_delete=models.SET_NULL) #FIXME opravit po migraci
vytvoreno = models.DateTimeField(
'Vytvořeno',
@ -517,7 +523,8 @@ class Soustredeni(SeminarModelBase):
# Interní ID
id = models.AutoField(primary_key = True)
rocnik = models.ForeignKey(Rocnik, verbose_name='ročník', related_name='soustredeni')
rocnik = models.ForeignKey(Rocnik, verbose_name='ročník', related_name='soustredeni',
on_delete=models.PROTECT)
datum_zacatku = models.DateField('datum začátku', blank=True, null=True,
help_text='První den soustředění')
@ -589,7 +596,8 @@ class Problem(SeminarModelBase):
# Problém má podproblémy
nadproblem = models.ForeignKey('self', verbose_name='nadřazený problém',
related_name='nadproblem_%(class)s', null=True, blank=True)
related_name='nadproblem_%(class)s', null=True, blank=True,
on_delete=models.SET_NULL)
STAV_NAVRH = 'navrh'
STAV_ZADANY = 'zadany'
@ -610,10 +618,12 @@ class Problem(SeminarModelBase):
help_text='Neveřejný návrh úlohy, návrh řešení, text zadání, poznámky ...')
autor = models.ForeignKey(Organizator, verbose_name='autor problému',
related_name='autor_problemu_%(class)s', null=True, blank=True)
related_name='autor_problemu_%(class)s', null=True, blank=True,
on_delete=models.SET_NULL)
garant = models.ForeignKey(Organizator, verbose_name='garant zadaného problému',
related_name='garant_problemu_%(class)s', null=True, blank=True)
related_name='garant_problemu_%(class)s', null=True, blank=True,
on_delete=models.SET_NULL)
opravovatele = models.ManyToManyField(Organizator, verbose_name='opravovatelé',
blank=True, related_name='opravovatele_%(class)s')
@ -676,7 +686,8 @@ class Tema(Problem):
tema_typ = models.CharField('Typ tématu', max_length=16, choices=TEMA_CHOICES,
blank=False, default=TEMA_TEMA)
rocnik = models.ForeignKey(Rocnik, verbose_name='ročník',blank=True, null=True)
rocnik = models.ForeignKey(Rocnik, verbose_name='ročník',blank=True, null=True,
on_delete=models.PROTECT)
def kod_v_rocniku(self):
if self.stav == 'zadany':
@ -691,7 +702,8 @@ class Clanek(Problem):
verbose_name = 'Článek'
verbose_name_plural = 'Články'
cislo = models.ForeignKey(Cislo, verbose_name='číslo', blank=True, null=True)
cislo = models.ForeignKey(Cislo, verbose_name='číslo', blank=True, null=True,
on_delete=models.PROTECT)
# má OneToOneField s:
# ClanekNode
@ -730,14 +742,15 @@ class Uloha(Problem):
verbose_name_plural = 'Úlohy'
cislo_zadani = models.ForeignKey(Cislo, verbose_name='číslo zadání', blank=True,
null=True, related_name='zadane_ulohy')
null=True, related_name='zadane_ulohy', on_delete=models.PROTECT)
cislo_deadline = models.ForeignKey(Cislo, verbose_name='číslo deadlinu', blank=True,
null=True, related_name='deadlinove_ulohy')
null=True, related_name='deadlinove_ulohy', on_delete=models.PROTECT)
cislo_reseni = models.ForeignKey(Cislo, verbose_name='číslo řešení', blank=True,
null=True, related_name='resene_ulohy',
help_text='Číslo s řešením úlohy, jen pro úlohy')
help_text='Číslo s řešením úlohy, jen pro úlohy',
on_delete=models.PROTECT)
max_body = models.DecimalField(max_digits=8, decimal_places=1, verbose_name='maximum bodů',
blank=True, null=True)
@ -790,7 +803,8 @@ class Reseni(SeminarModelBase):
default=FORMA_EMAIL)
text_cely = models.OneToOneField(Text, verbose_name='Plná verze textu řešení',
blank=True, null=True, related_name="reseni_cely_set")
blank=True, null=True, related_name="reseni_cely_set",
on_delete=models.SET_NULL)
text_zkraceny = models.ManyToManyField(Text, verbose_name='zkrácené verze řešení',
help_text='Seznam úryvků z řešení',related_name="reseni_zkraceny_set")
@ -829,11 +843,11 @@ class Hodnoceni(SeminarModelBase):
blank=False, null=False)
cislo_body = models.ForeignKey(Cislo, verbose_name='číslo pro body',
related_name='hodnoceni', blank=False, null=False)
related_name='hodnoceni', blank=False, null=False, on_delete=models.PROTECT)
reseni = models.ForeignKey(Reseni, verbose_name='řešení')
reseni = models.ForeignKey(Reseni, verbose_name='řešení', on_delete=models.CASCADE)
problem = models.ForeignKey(Problem, verbose_name='problém')
problem = models.ForeignKey(Problem, verbose_name='problém', on_delete=models.PROTECT)
def __str__(self):
return "{}, {}, {}".format(self.problem, self.reseni, self.body)
@ -884,7 +898,8 @@ class PrilohaReseni(SeminarModelBase):
# Interní ID
id = models.AutoField(primary_key = True)
reseni = models.ForeignKey(Reseni, verbose_name='řešení', related_name='prilohy')
reseni = models.ForeignKey(Reseni, verbose_name='řešení', related_name='prilohy',
on_delete=models.CASCADE)
vytvoreno = models.DateTimeField('vytvořeno', default=timezone.now, blank=True, editable=False)
@ -915,7 +930,8 @@ class Pohadka(SeminarModelBase):
# Při nahrávání z TeXu není vyplnění vyžadováno, v adminu je
null=True,
blank=False
blank=False,
on_delete=models.SET_NULL
)
vytvoreno = models.DateTimeField(
@ -946,9 +962,10 @@ class Soustredeni_Ucastnici(SeminarModelBase):
# Interní ID
id = models.AutoField(primary_key = True)
resitel = models.ForeignKey(Resitel, verbose_name='řešitel')
resitel = models.ForeignKey(Resitel, verbose_name='řešitel', on_delete=models.PROTECT)
soustredeni = models.ForeignKey(Soustredeni, verbose_name='soustředění')
soustredeni = models.ForeignKey(Soustredeni, verbose_name='soustředění',
on_delete=models.PROTECT)
poznamka = models.TextField('neveřejná poznámka', blank=True,
help_text='Neveřejná poznámka k účasti (plain text)')
@ -970,9 +987,11 @@ class Soustredeni_Organizatori(SeminarModelBase):
# Interní ID
id = models.AutoField(primary_key = True)
organizator = models.ForeignKey(Organizator, verbose_name='organizátor')
organizator = models.ForeignKey(Organizator, verbose_name='organizátor',
on_delete=models.PROTECT)
soustredeni = models.ForeignKey(Soustredeni, verbose_name='soustředění')
soustredeni = models.ForeignKey(Soustredeni, verbose_name='soustředění',
on_delete=models.PROTECT)
poznamka = models.TextField('neveřejná poznámka', blank=True,
help_text='Neveřejná poznámka k účasti organizátora (plain text)')
@ -1003,6 +1022,7 @@ class Konfera(models.Model):
organizator = models.ForeignKey(Organizator, verbose_name='organizátor', related_name='konfery',
on_delete = models.SET_NULL, null=True)
# FIXME: Umíme omezit jen na účastníky daného soustřeďka?
ucastnici = models.ManyToManyField(Resitel, verbose_name='účastníci konfery',
help_text='Seznam účastníků konfery', through='Konfery_Ucastnici')
@ -1052,9 +1072,9 @@ class Reseni_Resitele(models.Model):
# Interní ID
id = models.AutoField(primary_key = True)
resitele = models.ForeignKey(Resitel, verbose_name='řešitel')
resitele = models.ForeignKey(Resitel, verbose_name='řešitel', on_delete=models.PROTECT)
reseni = models.ForeignKey(Reseni, verbose_name='řešení')
reseni = models.ForeignKey(Reseni, verbose_name='řešení', on_delete=models.CASCADE)
# podil - jakou merou se ktery resitel podilel na danem reseni
# - pouziti v budoucnu, pokud by resitele nemeli dostat vsichni stejne bodu za spolecne reseni
@ -1075,9 +1095,9 @@ class Konfery_Ucastnici(models.Model):
# Interní ID
id = models.AutoField(primary_key = True)
resitel = models.ForeignKey(Resitel, verbose_name='řešitel')
resitel = models.ForeignKey(Resitel, verbose_name='řešitel', on_delete=models.PROTECT)
konfera = models.ForeignKey(Konfera, verbose_name='konfera')
konfera = models.ForeignKey(Konfera, verbose_name='konfera', on_delete=models.CASCADE)
poznamka = models.TextField('neveřejná poznámka', blank=True,
help_text='Neveřejná poznámka k účasti (plain text)')
@ -1099,7 +1119,8 @@ class Obrazek(SeminarModelBase):
null=True, blank=True)
text = models.ForeignKey(Text, verbose_name='text',
help_text='text, ve kterém se obrázek vyskytuje', null=False, blank=False)
help_text='text, ve kterém se obrázek vyskytuje',
null=False, blank=False, on_delete=models.CASCADE)
do_cisla_barevny = models.FileField('barevný obrázek do čísla',
help_text = 'Barevná verze obrázku do čísla',
@ -1318,10 +1339,11 @@ class Nastaveni(SingletonModel):
db_table = 'seminar_nastaveni'
verbose_name = 'Nastavení semináře'
aktualni_rocnik = models.ForeignKey(Rocnik, verbose_name='aktuální ročník', null=False)
aktualni_rocnik = models.ForeignKey(Rocnik, verbose_name='aktuální ročník',
null=False, on_delete=models.PROTECT)
aktualni_cislo = models.ForeignKey(Cislo, verbose_name='poslední vydané číslo',
null=False)
null=False, on_delete=models.PROTECT)
def __str__(self):
return 'Nastavení semináře'
@ -1355,7 +1377,8 @@ class Novinky(models.Model):
],
options={'quality': 95})
autor = models.ForeignKey(Organizator, verbose_name='Autor novinky', null=True)
autor = models.ForeignKey(Organizator, verbose_name='Autor novinky', null=True,
on_delete=models.SET_NULL)
zverejneno = models.BooleanField('Zveřejněno', default=False)

2
seminar/templatetags/mam_menu.py

@ -10,6 +10,6 @@ def seminar_rocniky(parser, token):
'rocniky': Rocnik.objects.all()
}
@register.assignment_tag
@register.simple_tag
def aktualni_rocniky():
return Rocnik.objects.all()

55
seminar/testutils.py

@ -2,11 +2,12 @@
import datetime
import random
import lorem
import django.contrib.auth
from django.db import transaction
import unidecode
from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni, PrilohaReseni, Nastaveni, Soustredeni, Soustredeni_Ucastnici, Osoba, Organizator, Prijemce, Tema, Uloha
from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni, PrilohaReseni, Nastaveni, Soustredeni, Soustredeni_Ucastnici, Soustredeni_Organizatori, Osoba, Organizator, Prijemce, Tema, Uloha, Konfera, KonferaNode, Konfera_Ucastnici
from django.contrib.flatpages.models import FlatPage
from django.contrib.sites.models import Site
@ -59,6 +60,7 @@ def gen_osoby(rnd, size):
datum_registrace = datetime.date(rnd.randint(2019, 2029),
rnd.randint(1, 12), rnd.randint(1, 28))))
#TODO pridat foto male a velke. Jak?
# Pavel tvrdí, že to necháme a přidáme až do adminu
return osoby
@ -205,19 +207,24 @@ def gen_ulohy_do_cisla(rnd, cislo, organizatori, resitele, slovnik_cisel, size):
)
return
def gen_soustredeni():
# TODO: vice soustredeni a k nim nahodne podmnoziny organizatoru a ucastniku
# TODO: pozor, organizatori a ucastnici jsou ManyToManyField, musí se přiřadit
# mimo create() a pak dát save()
sous = Soustredeni.objects.create(rocnik=Rocnik.objects.first(),
verejne_db=True,
misto=u'Někde',
datum_zacatku=datetime.date(2000, 11, 23),
datum_konce=datetime.date(2000, 11, 27)
)
for res in rnd.sample(resitele, min(len(resitele), 20)):
Soustredeni_Ucastnici.objects.create(resitel=res, soustredeni=sous)
sous.save()
def gen_soustredeni(rnd, resitele, organizatori):
soustredeni = []
for _ in range(1, size): #FIXME Tu range si změňte jak chcete, nevím, co přesně znamená size (asi Anet?)
datum_zacatku=datetime.date(randint(2000, 2020), randint(1, 12), radint(1, 28))
working_sous = Soustredeni.objects.create(
rocnik=Rocnik.objects.order_by('?').first(),
verejne_db=rnd.choice([True, False]),
misto=rnd.choice(['Kremrolovice', 'Indiánov', 'U zmzliny', 'Vafláreň', 'Větrník', 'Horní Rakvička', 'Dolní cheesecake']),
typ=rnd.choice(['jarni', 'podzmini', 'vikend']),
datum_zacatku=datum_zacatku,
datum_konce=datum_zacatku + datetime.timedelta(weeks=1))
for res in rnd.sample(resitele, min(len(resitele), 20)):
Soustredeni_Ucastnici.objects.create(resitel=res, soutredeni=working_sous)
for org in rnd.sample(organizatori, min(len(organizatori), 20)):
Soustredeni_Organizatori.objects.create(organizator=org, soutredeni=working_sous)
working_sous.save()
soustredeni.append(working_sous)
return soustredeni
def gen_rocniky(last_rocnik, size):
rocniky = []
@ -229,6 +236,26 @@ def gen_rocniky(last_rocnik, size):
rocniky.append(rocnik)
return rocniky
def gen_konfery(rnd, reseni, organizatori, ucastnici, soustredeni):
konfery = []
for _ in range(1, size): #FIXME Tu range si změňte jak chcete, nevím, co přesně znamená size (asi Anet?)
konfera = Konfera.objects.create(
nazev=rnd.choice(['Pozorování', 'Zkoumání', 'Modelování', 'Počítání', 'Zkoušení']) + rnd.choice(' vlastností', ' jevů', ' charakteristik']) + rnd.choice([' vektorových prostorů', ' kinetické terorie látek', ' molekulární biologie', ' syntentických stromů']),
anotace=lorem.paragraph(),
abstrakt=lorem.paragraph(),
organizator=rnd.choice(organizatori),
soustredeni=rnd.choice(soustredeni),
reseni=rnd.choice(reseni),
typ_prezentace=rnd.choice(['veletrh', 'prezentace']))
for res in rnd.sample(ucastnici, min(len(ucastnici), randint(3, 6))):
Konfery_Ucastnici.objects.create(resitel=res, konfera=konfera)
konfery.append(konfera)
konfera.save()
konferanode = KonferaNode.objects.create(konfera=konfera)
konferanode.save()
return konfery
def gen_cisla(rocniky):
slovnik_rocnik_cisla = {}
for rocnik in rocniky:

74
seminar/urls.py

@ -9,100 +9,100 @@ staff_member_required = user_passes_test(lambda u: u.is_staff)
urlpatterns = [
# REDIRECTy
url(r'^jak-resit/$', RedirectView.as_view(url='/co-je-MaM/jak-resit/')),
url('jak-resit/', RedirectView.as_view(url='/co-je-MaM/jak-resit/')),
# Organizatori
url(r'^co-je-MaM/organizatori/$', views.CojemamOrganizatoriView.as_view(), name='organizatori'),
url(r'^co-je-MaM/organizatori/organizovali/$', views.CojemamOrganizatoriStariView.as_view(), name='stari_organizatori'),
url('co-je-MaM/organizatori/', views.CojemamOrganizatoriView.as_view(), name='organizatori'),
url('co-je-MaM/organizatori/organizovali/', views.CojemamOrganizatoriStariView.as_view(), name='stari_organizatori'),
# Archiv
url(r'^archiv/cisla/$', views.ArchivView.as_view()),
url(r'^archiv/temata/$', views.ArchivTemataView.as_view()),
url('archiv/cisla/', views.ArchivView.as_view()),
url('archiv/temata/', views.ArchivTemataView.as_view()),
url(r'^rocnik/(?P<rocnik>\d+)/$', views.RocnikView.as_view(), name='seminar_rocnik'),
#url(r'^cislo/(?P<rocnik>\d+)\.(?P<cislo>[0-9-]+)/$', views.CisloView.as_view(), name='seminar_cislo'),
url(r'^problem/(?P<pk>\d+)/$', views.ProblemView.as_view(), name='seminar_problem'),
#url(r'^problem/(?P<pk>\d+)/(?P<prispevek>\d+)/$', views.PrispevekView.as_view(), name='seminar_problem_prispevek'),
url('rocnik/<int:rocnik>/', views.RocnikView.as_view(), name='seminar_rocnik'),
#url('cislo/<int:rocnik>.<int:cislo>/', views.CisloView.as_view(), name='seminar_cislo'),
url('problem/<int:pk>/', views.ProblemView.as_view(), name='seminar_problem'),
#url('problem/(?P<pk>\d+)/(?P<prispevek>\d+)/', views.PrispevekView.as_view(), name='seminar_problem_prispevek'),
# Soustredeni
url(
r'^soustredeni/probehlo/$',
'soustredeni/probehlo/',
views.SoustredeniListView.as_view(),
name='seminar_seznam_soustredeni'
),
url(
r'^soustredeni/probehlo/(?P<soustredeni>\d+)/$',
'soustredeni/probehlo/<int:soustredeni>/',
views.SoustredeniView.as_view(),
name='seminar_soustredeni'
),
url(
r'^soustredeni/(?P<soustredeni>\d+)/seznam_ucastniku$',
'soustredeni/<int:soustredeni>/seznam_ucastniku',
staff_member_required(views.SoustredeniUcastniciView.as_view()),
name='soustredeni_ucastnici'
),
url(
r'^soustredeni/(?P<soustredeni>\d+)/maily_ucastniku$',
'soustredeni/<int:soustredeni>/maily_ucastniku',
staff_member_required(views.SoustredeniMailyUcastnikuView.as_view()),
name='maily_ucastniku'
),
url(
r'^soustredeni/(?P<soustredeni>\d+)/export_ucastniku$',
'soustredeni/<int:soustredeni>/export_ucastniku',
staff_member_required(views.soustredeniUcastniciExportView),
name='soustredeni_ucastnici_export'
),
url(
r'^soustredeni/(?P<soustredeni>\d+)/fotogalerie/',
'soustredeni/<int:soustredeni>/fotogalerie/',
include('galerie.urls')
),
# Zadani
url(r'^zadani/aktualni/$', views.AktualniZadaniView, name='seminar_aktualni_zadani'),
url(r'^zadani/temata/$', views.ZadaniTemataView, name='seminar_temata'),
#url(r'^zadani/vysledkova-listina/$', views.ZadaniAktualniVysledkovkaView, name='seminar_vysledky'),
url(r'^$', views.TitulniStranaView.as_view(), name='titulni_strana'),
url(r'^stare-novinky/$', views.StareNovinkyView.as_view(), name='stare_novinky'),
url('zadani/aktualni/', views.AktualniZadaniView, name='seminar_aktualni_zadani'),
url('zadani/temata/', views.ZadaniTemataView, name='seminar_temata'),
#url('zadani/vysledkova-listina/', views.ZadaniAktualniVysledkovkaView, name='seminar_vysledky'),
url('', views.TitulniStranaView.as_view(), name='titulni_strana'),
url('stare-novinky/', views.StareNovinkyView.as_view(), name='stare_novinky'),
# Clanky
url(r'^clanky/resitel/$', views.ClankyResitelView.as_view(), name='clanky_resitel'),
#url(r'^clanky/org/$', views.ClankyOrganizatorView.as_view(), name='clanky_organizator'),
url('clanky/resitel/', views.ClankyResitelView.as_view(), name='clanky_resitel'),
#url('clanky/org/', views.ClankyOrganizatorView.as_view(), name='clanky_organizator'),
# Aesop
url(r'^aesop-export/mam-rocnik-(?P<prvni_rok>\d+)\.csv$', export.ExportRocnikView.as_view(), name='seminar_export_rocnik'),
url(r'^aesop-export/mam-sous-(?P<datum_zacatku>[\d-]+)\.csv$', export.ExportSousView.as_view(), name='seminar_export_sous'),
url(r'^aesop-export/index.csv$', export.ExportIndexView.as_view(), name='seminar_export_index'),
url('aesop-export/mam-rocnik-<int:prvni_rok>.csv', export.ExportRocnikView.as_view(), name='seminar_export_rocnik'),
url('aesop-export/mam-sous-<str:datum_zacatku>.csv', export.ExportSousView.as_view(), name='seminar_export_sous'),
url('aesop-export/index.csv', export.ExportIndexView.as_view(), name='seminar_export_index'),
# Stranky viditelne pouze pro orgy:
#url(
# r'^rocnik/(?P<rocnik>\d+)/vysledkovka.tex$',
# 'rocnik/(?P<rocnik>\d+)/vysledkovka.tex',
# staff_member_required(views.RocnikVysledkovkaView.as_view()),
# name='seminar_cislo_vysledkovka'
#),
#url(r'^cislo/(?P<rocnik>\d+).(?P<cislo>[0-9-]+)/vysledkovka.tex$',
#url('cislo/(?P<rocnik>\d+).(?P<cislo>[0-9-]+)/vysledkovka.tex',
# staff_member_required(views.CisloVysledkovkaView.as_view()), name='seminar_cislo_vysledkovka'),
url(r'^cislo/(?P<rocnik>\d+).(?P<cislo>[0-9-]+)/obalky.pdf$',
url('cislo/<int:rocnik>.<int:cislo>/obalky.pdf',
staff_member_required(views.cisloObalkyView), name='seminar_cislo_obalky'),
#url(r'^cislo/(?P<rocnik>\d+).(?P<cislo>[0-9-]+)/tituly.tex$',
#url('cislo/(?P<rocnik>\d+).(?P<cislo>[0-9-]+)/tituly.tex',
# staff_member_required(views.TitulyView), name='seminar_cislo_titul'),
url(r'^stav$',
url('stav',
staff_member_required(views.StavDatabazeView), name='stav_databaze'),
url(r'^cislo/(?P<rocnik>\d+).(?P<cislo>[0-9-]+)/obalkovani$',
url('cislo/<int:rocnik>.<int:cislo>/obalkovani',
staff_member_required(views.obalkovaniView), name='seminar_cislo_resitel_obalkovani'),
url(r'^cislo/(?P<rocnik>\d+).(?P<cislo>[0-9-]+)/tex-download.json$',
url('cislo/<int:rocnik>.<int:cislo>/tex-download.json',
staff_member_required(views.texDownloadView), name='seminar_tex_download'),
url(r'^soustredeni/(?P<soustredeni>\d+)/obalky.pdf',
url('soustredeni/<int:soustredeni>/obalky.pdf',
staff_member_required(views.soustredeniObalkyView), name='seminar_soustredeni_obalky'),
url(r'^tex-upload/login/$', views.LoginView, name='seminar_login'),
url('tex-upload/login/', views.LoginView, name='seminar_login'),
url(
r'^tex-upload/$',
'tex-upload/',
staff_member_required(views.texUploadView),
name='seminar_tex_upload'
),
url(r'^prihlaska/$',views.get_name),
url('prihlaska/',views.get_name),
# Ceka na autocomplete v3
# url(r'^autocomplete/organizatori/$',
# url('autocomplete/organizatori/',
# staff_member_required(views.OrganizatorAutocomplete.as_view()),
# name='seminar_autocomplete_organizator')

2
seminar/views.py

@ -2,7 +2,7 @@
from django.shortcuts import get_object_or_404, render
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidden, JsonResponse
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.core.exceptions import PermissionDenied, ObjectDoesNotExist
from django.views import generic
from django.utils.translation import ugettext as _

Loading…
Cancel
Save