Matěj Kocián
8 years ago
25 changed files with 637 additions and 41 deletions
@ -0,0 +1,25 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('seminar', '0041_konfery'), |
|||
('korektury', '0013_rename_autor_org'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AddField( |
|||
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), |
|||
), |
|||
] |
@ -0,0 +1,19 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('korektury', '0014_add_org_to_pdf'), |
|||
] |
|||
|
|||
operations = [ |
|||
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), |
|||
), |
|||
] |
@ -1,7 +1,59 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from django.contrib import admin |
|||
from django.contrib import messages |
|||
from django import forms |
|||
from reversion.admin import VersionAdmin |
|||
from autocomplete_light import shortcuts as autocomplete_light |
|||
from django.db import models |
|||
|
|||
from models import Prednaska, Seznam, Hlasovani |
|||
from models import Prednaska, Seznam, STAV_NAVRH |
|||
from seminar.models import Soustredeni |
|||
|
|||
admin.site.register(Seznam) |
|||
admin.site.register(Prednaska) |
|||
admin.site.register(Hlasovani) |
|||
class Seznam_PrednaskaInline(admin.TabularInline): |
|||
# form = autocomplete_light.modelform_factory(Prednaska, autocomplete_fields=['nazev'], fields=['nazev']) |
|||
model = Prednaska.seznamy.through |
|||
# fields = ['nazev', 'org', 'obor' ] |
|||
# extra = 0 |
|||
# formfield_overrides = { |
|||
# models.TextField: {'widget': forms.TextInput}, |
|||
# } |
|||
|
|||
# def get_queryset(self, request): |
|||
# qs = super(Seznam_PrednaskaInline, self).get_queryset(request) |
|||
# return qs.select_related('seznam', 'prednaska') |
|||
|
|||
class SeznamAdmin(VersionAdmin): |
|||
list_display = ['soustredeni','stav'] |
|||
inlines = [Seznam_PrednaskaInline] |
|||
|
|||
admin.site.register(Seznam,SeznamAdmin) |
|||
|
|||
|
|||
class PrednaskaAdmin(VersionAdmin): |
|||
list_display = ['nazev', 'org', 'obor'] |
|||
list_filter = ['org','obor'] |
|||
search_fields = [] |
|||
|
|||
actions = ['move_to_soustredeni'] |
|||
|
|||
def move_to_soustredeni(self,request,queryset): |
|||
sous = Soustredeni.objects.first() |
|||
seznam = Seznam.objects.filter(soustredeni=sous,stav=STAV_NAVRH) |
|||
if len(seznam) == 0: |
|||
self.message_user(request,u"Není definován seznam pro aktuální soustředění, nic se neprovedlo",messages.ERROR) |
|||
return |
|||
seznam = seznam[0] |
|||
for prednaska in queryset: |
|||
prednaska.seznamy.add(seznam) |
|||
prednaska.save() |
|||
|
|||
self.message_user(request,u"Vybrané přednášky ({}) přidány jako návrhy na nejbližší soustředění".format(len(queryset))) |
|||
|
|||
move_to_soustredeni.short_description=u"Přidat přednášky do návrhu na nejbližší soustředění" |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
admin.site.register(Prednaska,PrednaskaAdmin) |
|||
|
@ -0,0 +1,64 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('prednasky', '0002_auto_20160417_2347'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.RenameModel( |
|||
old_name='Seznam', |
|||
new_name='Seznam_old', |
|||
), |
|||
migrations.AlterModelOptions( |
|||
name='hlasovani', |
|||
options={'ordering': ['ucastnik', 'prednaska'], 'verbose_name': 'Hlasov\xe1n\xed', 'verbose_name_plural': 'Hlasov\xe1n\xed'}, |
|||
), |
|||
migrations.AlterModelOptions( |
|||
name='prednaska', |
|||
options={'ordering': ['org', 'nazev'], 'verbose_name': 'P\u0159edn\xe1\u0161ka', 'verbose_name_plural': 'P\u0159edn\xe1\u0161ky'}, |
|||
), |
|||
migrations.AddField( |
|||
model_name='prednaska', |
|||
name='popis', |
|||
field=models.TextField(help_text=b'Neve\xc5\x99ejn\xc3\xbd popis pro ostatn\xc3\xad orgy', null=True, verbose_name=b'Popis pro orgy'), |
|||
), |
|||
migrations.AlterField( |
|||
model_name='hlasovani', |
|||
name='id', |
|||
field=models.AutoField(serialize=False, primary_key=True), |
|||
), |
|||
migrations.AlterField( |
|||
model_name='prednaska', |
|||
name='anotace', |
|||
field=models.TextField(help_text=b'Ve\xc5\x99ejn\xc3\xa1 anotace v hlasov\xc3\xa1n\xc3\xad', null=True, verbose_name=b'Anotace'), |
|||
), |
|||
migrations.AlterField( |
|||
model_name='prednaska', |
|||
name='id', |
|||
field=models.AutoField(serialize=False, primary_key=True), |
|||
), |
|||
migrations.AlterField( |
|||
model_name='prednaska', |
|||
name='obor', |
|||
field=models.CharField(help_text=b'Podmno\xc5\xbeina MFIOB', max_length=5, verbose_name=b'Obor'), |
|||
), |
|||
migrations.AlterField( |
|||
model_name='prednaska', |
|||
name='seznam', |
|||
field=models.ForeignKey(to='prednasky.Seznam_old'), |
|||
), |
|||
migrations.AlterModelTable( |
|||
name='hlasovani', |
|||
table='prednasky_hlasovani', |
|||
), |
|||
migrations.AlterModelTable( |
|||
name='prednaska', |
|||
table='prednasky_prednaska', |
|||
), |
|||
] |
@ -0,0 +1,18 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('prednasky', '0003_auto_20160929_0117'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.RemoveField( |
|||
model_name='prednaska', |
|||
name='seznam', |
|||
), |
|||
] |
@ -0,0 +1,49 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('seminar', '0041_konfery'), |
|||
('prednasky', '0004_remove_prednaska_seznam'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.CreateModel( |
|||
name='Prednaska_Seznam', |
|||
fields=[ |
|||
('id', models.AutoField(serialize=False, primary_key=True)), |
|||
('prednaska', models.ForeignKey(to='prednasky.Prednaska')), |
|||
], |
|||
options={ |
|||
'db_table': 'prednasky_prednaska_seznam', |
|||
'verbose_name': 'P\u0159edn\xe1\u0161ka v seznamu', |
|||
'verbose_name_plural': 'P\u0159edn\xe1\u0161ky v seznamech', |
|||
}, |
|||
), |
|||
migrations.CreateModel( |
|||
name='Seznam', |
|||
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)), |
|||
], |
|||
options={ |
|||
'ordering': ['soustredeni', 'stav'], |
|||
'db_table': 'prednasky_seznam', |
|||
'verbose_name': 'Seznam p\u0159edn\xe1\u0161ek', |
|||
'verbose_name_plural': 'Seznamy p\u0159edn\xe1\u0161ek', |
|||
}, |
|||
), |
|||
migrations.DeleteModel( |
|||
name='Seznam_old', |
|||
), |
|||
migrations.AddField( |
|||
model_name='prednaska_seznam', |
|||
name='seznam', |
|||
field=models.ForeignKey(to='prednasky.Seznam'), |
|||
), |
|||
] |
@ -0,0 +1,20 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('prednasky', '0005_auto_20160929_0153'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AddField( |
|||
model_name='hlasovani', |
|||
name='seznam', |
|||
field=models.ForeignKey(default=1, to='prednasky.Seznam'), |
|||
preserve_default=False, |
|||
), |
|||
] |
@ -0,0 +1,19 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('prednasky', '0006_hlasovani_seznam'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AddField( |
|||
model_name='prednaska', |
|||
name='seznamy', |
|||
field=models.ManyToManyField(to='prednasky.Seznam'), |
|||
), |
|||
] |
@ -0,0 +1,25 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('prednasky', '0007_prednaska_seznamy'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.RemoveField( |
|||
model_name='prednaska_seznam', |
|||
name='prednaska', |
|||
), |
|||
migrations.RemoveField( |
|||
model_name='prednaska_seznam', |
|||
name='seznam', |
|||
), |
|||
migrations.DeleteModel( |
|||
name='Prednaska_Seznam', |
|||
), |
|||
] |
@ -0,0 +1,49 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('prednasky', '0008_auto_20160929_0225'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AlterField( |
|||
model_name='prednaska', |
|||
name='anotace', |
|||
field=models.TextField(help_text='Ve\u0159ejn\xe1 anotace v hlasov\xe1n\xed', null=True, verbose_name=b'Anotace'), |
|||
), |
|||
migrations.AlterField( |
|||
model_name='prednaska', |
|||
name='klicova', |
|||
field=models.CharField(max_length=200, null=True, verbose_name='Kl\xed\u010dov\xe1 slova', blank=True), |
|||
), |
|||
migrations.AlterField( |
|||
model_name='prednaska', |
|||
name='nazev', |
|||
field=models.CharField(max_length=300, verbose_name='N\xe1zev'), |
|||
), |
|||
migrations.AlterField( |
|||
model_name='prednaska', |
|||
name='obor', |
|||
field=models.CharField(help_text='Podmno\u017eina MFIOB', max_length=5, verbose_name='Obor'), |
|||
), |
|||
migrations.AlterField( |
|||
model_name='prednaska', |
|||
name='obtiznost', |
|||
field=models.IntegerField(verbose_name='Obt\xed\u017enost', choices=[(1, b'Lehk\xc3\xa1'), (2, b'St\xc5\x99edn\xc3\xad'), (3, b'T\xc4\x9b\xc5\xbek\xc3\xa1')]), |
|||
), |
|||
migrations.AlterField( |
|||
model_name='prednaska', |
|||
name='popis', |
|||
field=models.TextField(help_text='Neve\u0159ejn\xfd popis pro ostatn\xed orgy', null=True, verbose_name='Popis pro orgy'), |
|||
), |
|||
migrations.AlterField( |
|||
model_name='seznam', |
|||
name='stav', |
|||
field=models.IntegerField(default=1, verbose_name=b'Stav', choices=[(1, b'N\xc3\xa1vrh'), (2, b'Bude')]), |
|||
), |
|||
] |
@ -0,0 +1,24 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('prednasky', '0009_auto_20160929_0354'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AlterField( |
|||
model_name='prednaska', |
|||
name='anotace', |
|||
field=models.TextField(help_text='Ve\u0159ejn\xe1 anotace v hlasov\xe1n\xed', null=True, verbose_name=b'Anotace', blank=True), |
|||
), |
|||
migrations.AlterField( |
|||
model_name='prednaska', |
|||
name='popis', |
|||
field=models.TextField(help_text='Neve\u0159ejn\xfd popis pro ostatn\xed orgy', null=True, verbose_name='Popis pro orgy', blank=True), |
|||
), |
|||
] |
@ -0,0 +1,26 @@ |
|||
{% extends "prednasky/Base.html" %} |
|||
|
|||
|
|||
{% block header %}hlasovani{% endblock %} |
|||
|
|||
{% block nadpis1a %}{% block nadpis1b %} |
|||
Hlasování o přednáškách |
|||
{% endblock %}{% endblock %} |
|||
|
|||
{% block content %} |
|||
{# Projdi vsechny seznamy #} |
|||
<div class="mam-org-only"> |
|||
<ul> |
|||
{% for seznam in object_list %} |
|||
<li> |
|||
{% if seznam.stav == 1 %} {# STAV_NAHRH = 1 #} |
|||
<a href="/prednasky/seznam_prednasek/{{seznam.id}}">Návrh přednášek na soustředění {{seznam.soustredeni.misto}} </a> |
|||
{% else %} |
|||
<a href="/prednasky/seznam_prednasek/{{seznam.id}}">Seznam přednášek na soustředění {{seznam.soustredeni.misto}} </a> |
|||
{% endif %} |
|||
<a href="/prednasky/seznam_prednasek/{{seznam.id}}/export">Export</a> |
|||
</li> |
|||
{% endfor %} |
|||
|
|||
{% endblock %} |
|||
|
@ -0,0 +1,21 @@ |
|||
{% extends "prednasky/Base.html" %} |
|||
|
|||
|
|||
{% block header %}seznam_prednasek{% endblock %} |
|||
|
|||
{% block nadpis1a %}{% block nadpis1b %} |
|||
Seznam přednášek |
|||
{% endblock %}{% endblock %} |
|||
|
|||
{% block content %} |
|||
<div class="mam-org-only"> |
|||
<ul> |
|||
{# Projdi vsechny prednasky #} |
|||
{% for prednaska in object_list %} |
|||
<li> |
|||
<strong>{{prednaska.nazev}}</strong> (<i>{{prednaska.obor}},{{prednaska.obtiznost}}</i>) - {{prednaska.org}} |
|||
</li> |
|||
{% endfor %} |
|||
|
|||
{% endblock %} |
|||
|
@ -0,0 +1,21 @@ |
|||
{% block content %} |
|||
{% spaceless %} |
|||
{% for hlas in hlasovani %} |
|||
hlas({{hlas.ucastnik}},{{hlas.prednaska.id}},{{hlas.body}}) |
|||
{% endfor %} |
|||
{% for prednaska in prednasky %} |
|||
prednaska({{prednaska.id}},{{prednaska.org.id}},{{prednaska.obtiznost}},{{prednaska.obor}}) |
|||
{% endfor %} |
|||
{% for org in orgove %} |
|||
org({{org.id}},4,0,15) |
|||
{% endfor %} |
|||
{% for org in orgove %} |
|||
{{org.id}};{{org}} |
|||
{% endfor %} |
|||
{% for prednaska in prednasky %} |
|||
{{prednaska.id}};{{prednaska.nazev}};{{prednaska.org.id}} |
|||
{{prednaska.body}} |
|||
{% endfor %} |
|||
{% endspaceless %} |
|||
{% endblock %} |
|||
|
@ -0,0 +1,15 @@ |
|||
from django.conf.urls import * # NOQA |
|||
from django.conf.urls import patterns, url |
|||
from django.contrib.auth.decorators import user_passes_test |
|||
from . import views |
|||
|
|||
staff_member_required = user_passes_test(lambda u: u.is_staff) |
|||
|
|||
urlpatterns = [ |
|||
url(r'^prednasky/$', views.newPrednaska), |
|||
url(r'^prednasky/hotovo$', views.Prednaska_hotovo), |
|||
url(r'^prednasky/metaseznam_prednasek$', staff_member_required(views.MetaSeznamListView.as_view()), name='metaseznam-list'), |
|||
url(r'^prednasky/seznam_prednasek/(?P<seznam>\d+)/$', staff_member_required(views.SeznamListView.as_view()), name='seznam-list'), |
|||
url(r'^prednasky/seznam_prednasek/(?P<seznam>\d+)/export$', staff_member_required(views.SeznamExportView), name='seznam-export'), |
|||
# url(r'^korektury/help/', staff_member_required(views.KorekturyHelpView.as_view()), name='korektury-help'), |
|||
] |
@ -0,0 +1,31 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.db import migrations, models |
|||
import django.db.models.deletion |
|||
import seminar.models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('seminar', '0041_konfery'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AlterField( |
|||
model_name='konfera', |
|||
name='materialy', |
|||
field=models.FileField(help_text='Dal\u0161\xed materi\xe1ly ke konfe\u0159e zabalen\xe9 do jednoho souboru', upload_to=seminar.models.generate_filename_konfera, verbose_name='materialy', blank=True), |
|||
), |
|||
migrations.AlterField( |
|||
model_name='konfera', |
|||
name='prezentace', |
|||
field=models.FileField(help_text='Prezentace nebo fotka posteru', upload_to=seminar.models.generate_filename_konfera, verbose_name='prezentace', blank=True), |
|||
), |
|||
migrations.AlterField( |
|||
model_name='konfera', |
|||
name='prispevek', |
|||
field=models.ForeignKey(related_name='konfery', on_delete=django.db.models.deletion.SET_NULL, blank=True, to='seminar.Problem', help_text='\xda\u010dastnick\xfd p\u0159\xedp\u011bvek o konfe\u0159e', null=True, verbose_name='p\u0159\xedsp\u011bvek do \u010d\xedsla'), |
|||
), |
|||
] |
Loading…
Reference in new issue