From 9c37f4352796dcb6db3d9d8c592686fe166d06ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Sun, 6 Nov 2016 21:20:10 +0100 Subject: [PATCH 01/14] =?UTF-8?q?F=C3=A1ze=20tvorby=20=C4=8D=C3=ADsla?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/admin.py | 50 +++++++++++++++++++++++--- seminar/migrations/0042_cislo_faze.py | 19 ++++++++++ seminar/migrations/0043_uprava_faze.py | 19 ++++++++++ seminar/migrations/0044_uprava_faze.py | 19 ++++++++++ seminar/models.py | 20 +++++++++++ 5 files changed, 122 insertions(+), 5 deletions(-) create mode 100644 seminar/migrations/0042_cislo_faze.py create mode 100644 seminar/migrations/0043_uprava_faze.py create mode 100644 seminar/migrations/0044_uprava_faze.py diff --git a/seminar/admin.py b/seminar/admin.py index 45cc5fb7..b1eb0f35 100644 --- a/seminar/admin.py +++ b/seminar/admin.py @@ -244,10 +244,28 @@ admin.site.register(Skola, SkolaAdmin) class CisloAdmin(VersionAdmin): fieldsets = [ - (None, {'fields': ['cislo', 'rocnik', 'verejne_db', 'verejna_vysledkovka', 'poznamka', 'pdf']}), - (u'Data', {'fields': ['datum_vydani', 'datum_deadline']}), + (None, { + 'fields': [ + 'cislo', + 'rocnik', + 'verejne_db', + 'verejna_vysledkovka', + 'faze', + 'poznamka', + 'pdf' + ] + }), + (u'Data', {'fields': ['datum_vydani', 'datum_deadline']}), ] - list_display = ['kod', 'rocnik', 'cislo', 'datum_vydani', 'datum_deadline', 'verejne', 'verejna_vysledkovka'] + list_display = [ + 'kod', + 'rocnik', + 'cislo', + 'datum_vydani', + 'datum_deadline', + 'verejne', + 'verejna_vysledkovka' + ] list_filter = ['rocnik'] view_on_site = Cislo.verejne_url actions = [ @@ -339,7 +357,20 @@ class PohadkaAdmin(VersionAdmin): return obj.uloha.cislo_zadani.rocnik.rocnik get_rocnik.short_description = u'Ročník' - list_display = ['__str__', 'get_rocnik', 'get_kod_ulohy', 'uloha', 'autor', 'timestamp'] + def get_readonly_fields(self, request, obj=None): + if not obj: + return [] + if obj.uloha.cislo_zadani.faze != 'admin': + return ['text'] + + list_display = [ + '__str__', + 'get_rocnik', + 'get_kod_ulohy', + 'uloha', + 'autor', + 'timestamp' + ] get_form = get_form_predvypln_autora @@ -375,12 +406,21 @@ class ProblemAdmin(VersionAdmin): (u'Vydání', {'fields': ['cislo_zadani', 'kod', 'cislo_reseni', 'opravovatel',]}), (None, {'fields': ['text_zadani', 'text_reseni', 'text_org',]}), ] - readonly_fields = ['timestamp', 'import_dakos_id'] list_select_related = True search_fields = ['nazev', 'text_zadani', 'text_reseni', 'text_org'] view_on_site = Problem.verejne_url ordering = ['-timestamp'] + def get_readonly_fields(self, request, obj=None): + readonly_fields = ['timestamp', 'import_dakos_id'] + if not obj: + return readonly_fields + if obj.cislo_zadani.faze != 'admin': + readonly_fields += ['nazev', 'text_zadani', 'body'] + if obj.cislo_reseni.faze != 'admin': + readonly_fields += ['text_reseni'] + return readonly_fields + def get_queryset(self, request): qs = super(ProblemAdmin, self).get_queryset(request) return qs.select_related('autor', 'opravovatel', 'cislo_zadani', 'cislo_reseni') diff --git a/seminar/migrations/0042_cislo_faze.py b/seminar/migrations/0042_cislo_faze.py new file mode 100644 index 00000000..7d35ace5 --- /dev/null +++ b/seminar/migrations/0042_cislo_faze.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0041_konfery'), + ] + + operations = [ + migrations.AddField( + model_name='cislo', + name='faze', + field=models.CharField(default='admin', help_text='B\u011bhem f\xe1ze "admin" se obsah \u010d\xedsla vytv\xe1\u0159\xed (a p\u0159\xedpadn\u011b komentuje) ve webov\xe9m rozhran\xed. B\u011bhem f\xe1ze "tex" u\u017e obsah ve webov\xe9m rozhran\xed editovat nelze. N\xe1vrhy na \xfapravy se pak p\xed\u0161\xed do korekturov\xe1tka a zan\xe1\u0161ej\xed do gitu. Z n\u011bj se pak generuje verze pro web.', max_length=32, verbose_name='F\xe1ze vytv\xe1\u0159en\xed obsahu'), + ), + ] diff --git a/seminar/migrations/0043_uprava_faze.py b/seminar/migrations/0043_uprava_faze.py new file mode 100644 index 00000000..29e06e01 --- /dev/null +++ b/seminar/migrations/0043_uprava_faze.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0042_cislo_faze'), + ] + + operations = [ + migrations.AlterField( + model_name='cislo', + name='faze', + field=models.CharField(default='admin', help_text='B\u011bhem f\xe1ze "admin" se obsah \u010d\xedsla vytv\xe1\u0159\xed (a p\u0159\xedpadn\u011b komentuje) ve webov\xe9m rozhran\xed. B\u011bhem f\xe1ze "tex" u\u017e obsah ve webov\xe9m rozhran\xed editovat nelze. N\xe1vrhy na \xfapravy se pak p\xed\u0161\xed do korekturov\xe1tka a zan\xe1\u0161ej\xed do gitu. Z n\u011bj se pak generuje verze pro web.', max_length=32, verbose_name='F\xe1ze vytv\xe1\u0159en\xed obsahu', choices=[('admin', 'Zad\xe1v\xe1n\xed \xfaloh do webu'), ('tex', '\xdapravy \xfaloh v TeXov\xe9m repozit\xe1\u0159i')]), + ), + ] diff --git a/seminar/migrations/0044_uprava_faze.py b/seminar/migrations/0044_uprava_faze.py new file mode 100644 index 00000000..c0cfe0dd --- /dev/null +++ b/seminar/migrations/0044_uprava_faze.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0043_auto_20161106_1951'), + ] + + operations = [ + migrations.AlterField( + model_name='cislo', + name='faze', + field=models.CharField(default='admin', help_text='B\u011bhem f\xe1ze "\xdapravy na webu" se obsah \u010d\xedsla vytv\xe1\u0159\xed (a p\u0159\xedpadn\u011b komentuje) ve webov\xe9m rozhran\xed. B\u011bhem f\xe1ze "\xdapravy na webu" u\u017e obsah ve webov\xe9m rozhran\xed editovat nelze a n\xe1vrhy na \xfapravy se p\xed\u0161\xed do korekturov\xe1tka a zan\xe1\u0161ej\xed do gitu. Z n\u011bj se pak generuje verze pro web.', max_length=32, verbose_name='F\xe1ze vytv\xe1\u0159en\xed obsahu', choices=[('admin', '\xdapravy na webu'), ('tex', '\xdapravy v TeXu')]), + ), + ] diff --git a/seminar/models.py b/seminar/models.py index 4c8fc3f0..ef9478d6 100644 --- a/seminar/models.py +++ b/seminar/models.py @@ -349,6 +349,26 @@ class Cislo(SeminarModelBase): pdf = models.FileField(u'pdf', upload_to=cislo_pdf_filename, null=True, blank=True, help_text=u'Pdf čísla, které si mohou řešitelé stáhnout') + FAZE_ADMIN = u'admin' + FAZE_TEX = u'tex' + FAZE_CHOICES = [ + (FAZE_ADMIN, u'Úpravy na webu'), + (FAZE_TEX, u'Úpravy v TeXu'), + ] + faze = models.CharField( + u'Fáze vytváření obsahu', + max_length=32, + default=FAZE_ADMIN, + choices=FAZE_CHOICES, + help_text=( + u'Během fáze "{}" se obsah čísla vytváří (a případně ' + u'komentuje) ve webovém rozhraní. Během fáze "{}" už obsah ve ' + u'webovém rozhraní editovat nelze a návrhy na úpravy se píší ' + u'do korekturovátka a zanášejí do gitu. Z něj se pak generuje ' + u'verze pro web.' + ).format(FAZE_CHOICES[0][1], FAZE_CHOICES[0][1]) + ) + def kod(self): return u'%s.%s' % (self.rocnik.rocnik, self.cislo) kod.short_description = u'Kód čísla' From bb18c6ed3182e56f8e1613eac53f9f93a1acf6c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Tue, 8 Nov 2016 10:54:00 +0100 Subject: [PATCH 02/14] =?UTF-8?q?Flake8:=20oprava=20nekontrolov=C3=A1n?= =?UTF-8?q?=C3=AD=20migrac=C3=AD=20v=20pre-commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _git_hooks/pre-commit | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/_git_hooks/pre-commit b/_git_hooks/pre-commit index 664a06ce..f78840d4 100755 --- a/_git_hooks/pre-commit +++ b/_git_hooks/pre-commit @@ -10,6 +10,11 @@ status=0 # select only changed python files which are not migrations changed=`git diff --cached --name-only | grep 'py$' | grep -v 'migrations/[0-9]'` +if [ -z $changed ] ; then + # Nothing to check. Note the exit is necessary -- we would not pass any + # paths to git diff below and it would output the diff unfiltered. + exit 0 +fi git diff --unified=1 --cached HEAD -- $changed > $TMPDIFF From 02a7076397aa7a2a14358b84e2ac1507f8f013aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Tue, 8 Nov 2016 12:30:24 +0100 Subject: [PATCH 03/14] =?UTF-8?q?TeX=20upload:=20nevytv=C3=A1=C5=99ej=20Pr?= =?UTF-8?q?obl=C3=A9my?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/views.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/seminar/views.py b/seminar/views.py index 141e9492..aefea9a5 100644 --- a/seminar/views.py +++ b/seminar/views.py @@ -670,7 +670,6 @@ def texUploadView(request): # Řešení má nastavené číslo svojí úlohy, ale obrázky jsou # ukládány do čísla, kde řešení vyšlo c = meta["cislo_reseni"] - uloz_soubory(request.FILES.items(), meta["rocnik"], c) # Zjistíme typ ukládaného problému typy = { @@ -680,8 +679,8 @@ def texUploadView(request): } problem_typ = typy[meta["typ"]] - # Pokud už problém existuje, vytáhneme jej z db a upravíme + # Pokud neexistuje, vytvoříme jej jedině pokud je to vynucené # Pokud ročník/číslo ještě neexistuje, vyhodí to výjimku -> # číslo/ročník se musí založit ručně v adminu @@ -698,14 +697,22 @@ def texUploadView(request): problem = None if existujici: problem = existujici[0] - # Jinak vytvoříme nový - else: + elif "vytvor" in q: + # vytvoříme nový problem = Problem( typ=problem_typ, stav=Problem.STAV_ZADANY, kod=meta["kod"], cislo_zadani=cislo ) + else: + return JsonResponse({ + "error": "Problém neexistuje: {} {}.{} kód {}".format( + meta["typ"], meta["rocnik"], meta["cislo"], meta["kod"] + ) + }) + + uloz_soubory(request.FILES.items(), meta["rocnik"], c) if meta["typ"] == "reseni": problem.text_reseni = html From 8671822ca0cad3de1a4f1af3d4908ea343938e83 Mon Sep 17 00:00:00 2001 From: "Tomas \"Jethro\" Pokorny" Date: Sat, 12 Nov 2016 14:00:49 +0100 Subject: [PATCH 04/14] Razeni lidi podle poctu korektur. --- korektury/templates/korektury/opraf.html | 4 ++-- korektury/views.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/korektury/templates/korektury/opraf.html b/korektury/templates/korektury/opraf.html index 6a92f28c..fddf1e0c 100644 --- a/korektury/templates/korektury/opraf.html +++ b/korektury/templates/korektury/opraf.html @@ -83,8 +83,8 @@

Děkujeme opravovatelům: - {% for autor,pocet in zasluhy.items %} - {{autor}} ({{pocet}}){% if not forloop.last %},{% endif %} + {% for z in zasluhy %} + {{z.autor}} ({{z.pocet}}){% if not forloop.last %},{% endif %} {% endfor %}


diff --git a/korektury/views.py b/korektury/views.py index 70cfaf6e..6562f8fd 100644 --- a/korektury/views.py +++ b/korektury/views.py @@ -184,6 +184,8 @@ class KorekturyView(generic.TemplateView): zasluhy[k.autor]+=1 else: zasluhy[k.autor]=1 + zasluhy = [{'autor':jmeno, 'pocet':pocet} for (jmeno,pocet) in zasluhy.items()] + zasluhy.sort(key=lambda z:z['pocet'],reverse=True) strany = set(o.strana for o in opravy) opravy_na_stranu = [{'strana': s, 'op_id': opravy.filter(strana=s)} for s in strany] From 67d61cabb7b86e3c3ae423ce0f36b2b40957eda6 Mon Sep 17 00:00:00 2001 From: "Tomas \"Jethro\" Pokorny" Date: Sat, 12 Nov 2016 15:41:30 +0100 Subject: [PATCH 05/14] U sbalenych korektur nezobrazovat ikony. --- korektury/static/korektury/opraf.js | 3 +++ korektury/templates/korektury/opraf.html | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/korektury/static/korektury/opraf.js b/korektury/static/korektury/opraf.js index a6d6244c..75591fe7 100644 --- a/korektury/static/korektury/opraf.js +++ b/korektury/static/korektury/opraf.js @@ -126,11 +126,14 @@ function img_click(element, ev) { function toggle_visibility(button){ var divbox = button.parentNode.parentNode.parentNode; var id = divbox.id; + var buttondiv = document.getElementById(id+'-buttons') var text = document.getElementById(id+'-body'); if (text.style.display == 'none'){ text.style.display = 'block'; + buttondiv.style.display = 'inline-block'; }else { text.style.display = 'none'; + buttondiv.style.display = 'none'; } for (var i=0;i
-
{{o.autor}}
-
+ {{o.autor}} + +
{% csrf_token %} @@ -147,11 +148,12 @@ + -
+
{{o.text}}
@@ -159,17 +161,17 @@ {% for k in o.komentare %}
-
+
{{k.autor}}
-
- + + {% csrf_token %} @@ -178,7 +180,7 @@
-
+
{{k.text}}
{% endfor %} From e0882def44d36a5edf2c95598d50937fc7cfb7b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Sat, 12 Nov 2016 21:27:25 +0100 Subject: [PATCH 06/14] =?UTF-8?q?TeX=20API:=20povoleno=20jen=20v=20ur?= =?UTF-8?q?=C4=8Dit=C3=BDch=20f=C3=A1z=C3=ADch=20=C4=8D=C3=ADsla?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/views.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/seminar/views.py b/seminar/views.py index aefea9a5..5ceabcb8 100644 --- a/seminar/views.py +++ b/seminar/views.py @@ -752,6 +752,12 @@ def texDownloadView(request, rocnik, cislo): """View posílající JSON se zadanými a řešenými problémy pro založení čísla """ cislo = Cislo.objects.get(rocnik__rocnik=rocnik, cislo=cislo) + if cislo.faze == cislo.FAZE_NAHRANO: + # obsah byl nahrán z TeXu na web, už je příliš složitý + return JsonResponse( + {"error": "Obsah čísla už byl nahrán z TeXu na web."} + ) + zadane = Problem.objects.filter( cislo_zadani=cislo, stav=Problem.STAV_ZADANY @@ -788,4 +794,7 @@ def texDownloadView(request, rocnik, cislo): } for p in resene ], } + + cislo.faze = Cislo.FAZE_TEX + cislo.save() return JsonResponse(response) From 206851690940463315e7ce89dd4cef8f67c8fa21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Sat, 12 Nov 2016 21:55:01 +0100 Subject: [PATCH 07/14] =?UTF-8?q?=C4=8C=C3=ADslo:=20nov=C3=A1=20f=C3=A1ze?= =?UTF-8?q?=20"Nahr=C3=A1no"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/migrations/0044_uprava_faze.py | 2 +- .../0045_cislo_pridani_faze_nahrano.py | 19 +++++++++++++++++++ seminar/models.py | 12 ++++++++---- 3 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 seminar/migrations/0045_cislo_pridani_faze_nahrano.py diff --git a/seminar/migrations/0044_uprava_faze.py b/seminar/migrations/0044_uprava_faze.py index c0cfe0dd..0d683d6c 100644 --- a/seminar/migrations/0044_uprava_faze.py +++ b/seminar/migrations/0044_uprava_faze.py @@ -7,7 +7,7 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('seminar', '0043_auto_20161106_1951'), + ('seminar', '0043_uprava_faze'), ] operations = [ diff --git a/seminar/migrations/0045_cislo_pridani_faze_nahrano.py b/seminar/migrations/0045_cislo_pridani_faze_nahrano.py new file mode 100644 index 00000000..06ca8201 --- /dev/null +++ b/seminar/migrations/0045_cislo_pridani_faze_nahrano.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0044_uprava_faze'), + ] + + operations = [ + migrations.AlterField( + model_name='cislo', + name='faze', + field=models.CharField(default='admin', help_text='B\u011bhem f\xe1ze "\xdapravy na webu" se obsah \u010d\xedsla vytv\xe1\u0159\xed (a p\u0159\xedpadn\u011b komentuje) ve webov\xe9m rozhran\xed. B\u011bhem f\xe1ze "\xdapravy v TeXu" u\u017e obsah ve webov\xe9m rozhran\xed editovat nelze a n\xe1vrhy na \xfapravy se p\xed\u0161\xed do korekturov\xe1tka a zan\xe1\u0161ej\xed do gitu. Z n\u011bj se pak vygeneruje verze pro web a \u010d\xedslo se p\u0159epne do f\xe1ze "Nahr\xe1no na web", co\u017e jen znamen\xe1, \u017ee u\u017e nejde automaticky st\xe1hnout obsah pro zalo\u017een\xed \u010d\xedsla v TeXu.', max_length=32, verbose_name='F\xe1ze vytv\xe1\u0159en\xed obsahu', choices=[('admin', '\xdapravy na webu'), ('tex', '\xdapravy v TeXu'), ('tex', 'Nahr\xe1no na web')]), + ), + ] diff --git a/seminar/models.py b/seminar/models.py index ef9478d6..828d6664 100644 --- a/seminar/models.py +++ b/seminar/models.py @@ -351,10 +351,12 @@ class Cislo(SeminarModelBase): FAZE_ADMIN = u'admin' FAZE_TEX = u'tex' + FAZE_NAHRANO = u'nahrano' FAZE_CHOICES = [ (FAZE_ADMIN, u'Úpravy na webu'), (FAZE_TEX, u'Úpravy v TeXu'), - ] + (FAZE_TEX, u'Nahráno na web'), + ] faze = models.CharField( u'Fáze vytváření obsahu', max_length=32, @@ -364,9 +366,11 @@ class Cislo(SeminarModelBase): u'Během fáze "{}" se obsah čísla vytváří (a případně ' u'komentuje) ve webovém rozhraní. Během fáze "{}" už obsah ve ' u'webovém rozhraní editovat nelze a návrhy na úpravy se píší ' - u'do korekturovátka a zanášejí do gitu. Z něj se pak generuje ' - u'verze pro web.' - ).format(FAZE_CHOICES[0][1], FAZE_CHOICES[0][1]) + u'do korekturovátka a zanášejí do gitu. Z něj se pak vygeneruje ' + u'verze pro web a číslo se přepne do fáze "{}", což jen znamená, ' + u'že už nejde automaticky stáhnout obsah pro založení čísla v ' + u'TeXu.' + ).format(FAZE_CHOICES[0][1], FAZE_CHOICES[1][1], FAZE_CHOICES[2][1]) ) def kod(self): From 4ea24e673a31b6578a501dbdc5b218fd3eb1b499 Mon Sep 17 00:00:00 2001 From: "Tomas \"Jethro\" Pokorny" Date: Mon, 14 Nov 2016 09:06:48 +0100 Subject: [PATCH 08/14] Pridana funkce na aktivni organizatory. Priprava na autocomplete organizatoru, ale potreba prejit na novou verzi django-autocomplete-light. --- seminar/urls.py | 5 +++++ seminar/views.py | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/seminar/urls.py b/seminar/urls.py index f7228b47..1133175c 100644 --- a/seminar/urls.py +++ b/seminar/urls.py @@ -68,4 +68,9 @@ urlpatterns = [ url(r'^tex-upload/login/$', views.LoginView, name='seminar_login'), url(r'^tex-upload/$', staff_member_required(views.texUploadView), name='seminar_tex_upload'), + + # Ceka na autocomplete v3 + #url(r'^autocomplete/organizatori/$', staff_member_required(views.OrganizatorAutocomplete.as_view()), name='seminar_autocomplete_organizator') + + ] diff --git a/seminar/views.py b/seminar/views.py index 141e9492..b9243f0f 100644 --- a/seminar/views.py +++ b/seminar/views.py @@ -123,11 +123,16 @@ class StareNovinkyView(generic.ListView): ### Co je M&M ## Organizatori +def aktivniOrganizatori(rok=date.today().year): + return Organizator.objects.exclude( + organizuje_do_roku__isnull=False, + organizuje_do_roku__lt=rok + ).order_by('user__first_name') class CojemamOrganizatoriView(generic.ListView): model = Organizator template_name='seminar/cojemam/organizatori.html' - queryset = Organizator.objects.exclude(organizuje_do_roku__isnull=False, organizuje_do_roku__lt=date.today().year).order_by('user__first_name') + queryset = aktivniOrganizatori() def get_context_data(self, **kwargs): context = super(CojemamOrganizatoriView, self).get_context_data(**kwargs) context['aktivni'] = True @@ -136,7 +141,7 @@ class CojemamOrganizatoriView(generic.ListView): class CojemamOrganizatoriStariView(generic.ListView): model = Organizator template_name='seminar/cojemam/organizatori.html' - queryset = Organizator.objects.filter(organizuje_do_roku__isnull=False, organizuje_do_roku__lt=date.today().year).order_by('-organizuje_do_roku') + queryset = aktivniOrganizatori().order_by('-organizuje_do_roku') ### Archiv @@ -782,3 +787,26 @@ def texDownloadView(request, rocnik, cislo): ], } return JsonResponse(response) + + + +# Ceka na autocomplete v3 +#class OrganizatorAutocomplete(autocomplete.Select2QuerySetView): +# def get_queryset(self): +# if not self.request.user.is_authenticated(): +# return Organizator.objects.none() +# +# qs = aktivniOrganizatori() +# +# if self.q: +# if self.q[0] == "!": +# qs = Organizator.objects.all() +# query = self.q[1:] +# else: +# query = self.q +# qs = qs.filter( +# Q(prezdivka__isstartswith=query)| +# Q(user__first_name__isstartswith=query)| +# Q(user__last_name__isstartswith=query)) +# +# return qs From c9754b98e30f71fc79240cc2598b8b70aa955f65 Mon Sep 17 00:00:00 2001 From: "Tomas \"Jethro\" Pokorny" Date: Mon, 14 Nov 2016 11:37:27 +0100 Subject: [PATCH 09/14] Barvy a preskrtnuti v seznamu korektur. --- korektury/static/korektury/opraf-list.css | 13 +++++++++++++ korektury/templates/korektury/seznam.html | 7 ++++++- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 korektury/static/korektury/opraf-list.css diff --git a/korektury/static/korektury/opraf-list.css b/korektury/static/korektury/opraf-list.css new file mode 100644 index 00000000..737b3c2c --- /dev/null +++ b/korektury/static/korektury/opraf-list.css @@ -0,0 +1,13 @@ +.adding-text{ + color: black; +} +.comitting-text +{ + color: yellow; +} +.deprecated-text { + color: red; + text-decoration: line-through; +} + + diff --git a/korektury/templates/korektury/seznam.html b/korektury/templates/korektury/seznam.html index c1d62175..991ca2c5 100644 --- a/korektury/templates/korektury/seznam.html +++ b/korektury/templates/korektury/seznam.html @@ -1,4 +1,9 @@ {% extends "korektury/base.html" %} +{% load staticfiles %} + +{% block script%} + +{% endblock %} {% block content %} @@ -12,7 +17,7 @@
    {% for pdf in object_list %} -
  • {{ pdf.nazev }} {{pdf.komentar}} {{pdf.pdf.name}}
  • +
  • {{ pdf.nazev }} {{pdf.komentar}} {{pdf.pdf.name}}
  • {% empty %}
  • Nejsou žádné dokumenty ke korekturování. {% endfor %} From 23ae79f61af884fb5ba07dc637e06b0cd4c3c5b9 Mon Sep 17 00:00:00 2001 From: "Tomas \"Jethro\" Pokorny" Date: Mon, 14 Nov 2016 12:02:20 +0100 Subject: [PATCH 10/14] Nelze komentovat uzavrene korektury. --- korektury/static/korektury/imgs/comment-gr.png | Bin 0 -> 4212 bytes korektury/templates/korektury/opraf.html | 7 +++++++ 2 files changed, 7 insertions(+) create mode 100644 korektury/static/korektury/imgs/comment-gr.png diff --git a/korektury/static/korektury/imgs/comment-gr.png b/korektury/static/korektury/imgs/comment-gr.png new file mode 100644 index 0000000000000000000000000000000000000000..3a35385e576aba200491ffb933580be1fa165b1d GIT binary patch literal 4212 zcmeHKYdDnK9)HI*qA0i8m1#msW>CarTn95d<2LR}#>|)*%*D*em?t~J4oOJjAk835 zlrEGsZM22#h+Hr-l+@#fGQe=^pf^!>ur;Q^r<_)h64aOSFX1|+Y1*1W-#etlt?0&9m^nsi5yB8 z0C0wce$;HSp~_0vfyGTIuw3i-y>MDh>#2l5-v_p@c)fiV^5(--X#zm=%59 zUh)+Z9#oWLo&_&0y{@G0nWVlKxwTr+pLp@^7i{??B6rFP-_lIj6?Laq=lG)0i7O4h zXCfBhC-1xEF~j$S?oNHC@|3uH?l2O~#R7!w`5&Xh6G)W$$mQD-d*(E7N zr|)2P`Bk-7nQ7tDd#bz&(L~xD(Foyz?G$ z@Gh?7*Nl9GV#X-vefzPl(Pa_7F{Cuvlab)_d2f;q@s%O3q$*=V9p6mI#^jusn8cz? zk4p#z2O54Ge4B}H3Qfy788c;KSF`Zy1o@xdXKo@EUjdU_~LL9NfPK8O?; zbyrAow_wS3vknDj4k;aI+T8|1x5Q*xP#?iR<15ncsMl> zBzTb&c)2(4N=N-JhTKKCsOsq6(Y}6F&6zknYQM(=GlfWNo!$oW))yHNu3N`e3V*1B z_u6wrn0Q;uW8`Y~**UBvF><_jRrr*F?dG!_|qq%su*BIy#-Dx%nTh8(i zvGU^z%HDdeJ~DF22#?MkTx!wm98Io~sM}=x_9@6B_@1_(1C%>*LF)@j{sGhY$_u-l z6M~}}jR^DU(y)PhT=q*Z+B-?L=L&m#O&zt`P1dhC3;6Yy7>+Iu|0xYGA^$b5P#A3d zdR#%I-cgOWQ;}VEZQ6v66a}0w<&}h-&AKF4=Qh{Q9C2^!;cZqZQp5(V;3>Qe;hT6z z-0x`ti`y3pKN?x8ce(pa$(!11jO;|assMmeI7J%6{4uU@Je>-~5$K^rD2K|BIspLI zwj2fyA3L_yq!{5D*YQbBqaw;YcJ?P+TSv%XRa{b0hFp1cy>_}%4!AGD+peDvn9Li}kh>bGX znn?(Qdm){_QAkG!2${`hz+teMm>6ixVJMwRf|*)bS;0)qU}k2lFXyKoVJarc^l!od#a##D&tM*$4W3(GG{ElLbj z084t;99VB42g3r6)TqctW1JL4o3|)iSdME2Apii>ibmRdTXqO9o8H`RuaVqUe|UMD z)_8zIGC6|u#m-pY2KnKmS6WE^gnX{Cj6s0`&YFF5Cc$ZlZbZr z-he}x61qxG(arSycmwIpC}=e*YWUshhPPFJo3Z_>Pe0dH%#6ReN!!Ed{Mcxb@GNg$ zM)Yb7&|C6de17+XcN(8_Qy`{FPDkIi?g9a^*Vg=@S7G`YV$JqtJ=WIt`7?^5!bDc5 zc6U2r&LoXr4~idWaQewdpn#;-L6+!%Eq%DLphzhU3%|gAdebL1dRhm`ZjnR!h~vw~NgSFeA(PT;ZsB nwx9PxgW$;p@jta!2PCQ*J(iw_j3w8ly9}V6+>o~%LeBjQqzJ@u literal 0 HcmV?d00001 diff --git a/korektury/templates/korektury/opraf.html b/korektury/templates/korektury/opraf.html index 36c61fcd..424e564d 100644 --- a/korektury/templates/korektury/opraf.html +++ b/korektury/templates/korektury/opraf.html @@ -145,9 +145,16 @@ {% endif %} + {% if o.status = 'opraveno' or o.status = 'neni_chyba' %} + + {% else %} + {% endif %} +