From 746bb4b34c1f2e23fa5b1c9d5f6eeb5bd28cc580 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Fri, 27 Nov 2015 18:22:15 +0100 Subject: [PATCH 01/26] =?UTF-8?q?Galerie:=20odstran=C4=9Bn=20datum=20u=20o?= =?UTF-8?q?br=C3=A1zku,=20=C5=99a=C4=8F=20dle=20n=C3=A1zvu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../0007_obrazek_odstranen_datum.py | 22 ++++++++++++++ galerie/models.py | 30 ++----------------- galerie/views.py | 4 +-- 3 files changed, 27 insertions(+), 29 deletions(-) create mode 100644 galerie/migrations/0007_obrazek_odstranen_datum.py diff --git a/galerie/migrations/0007_obrazek_odstranen_datum.py b/galerie/migrations/0007_obrazek_odstranen_datum.py new file mode 100644 index 00000000..94c3596b --- /dev/null +++ b/galerie/migrations/0007_obrazek_odstranen_datum.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('galerie', '0006_django_imagekit'), + ] + + operations = [ + migrations.AlterModelOptions( + name='obrazek', + options={'ordering': ['nazev'], 'verbose_name': 'Obr\xe1zek', 'verbose_name_plural': 'Obr\xe1zky'}, + ), + migrations.RemoveField( + model_name='obrazek', + name='datum', + ), + ] diff --git a/galerie/models.py b/galerie/models.py index 9d55a3bf..9f3b1478 100644 --- a/galerie/models.py +++ b/galerie/models.py @@ -1,19 +1,12 @@ # coding: utf-8 from django.db import models -import seminar.models -from django.db.models import Q -from django.utils import timezone +#from django.db.models import Q from django.utils.encoding import force_unicode from imagekit.models import ImageSpecField from imagekit.processors import ResizeToFit, Transpose -from PIL import Image -from PIL.ExifTags import TAGS import os -from cStringIO import StringIO -from django.core.files.base import ContentFile -from datetime import datetime from seminar.models import Soustredeni @@ -26,14 +19,6 @@ VIDITELNOST = ( (NIKDY, 'Nikdy'), ) -def get_exif(fn): - ret = {} - info = fn._getexif() - for tag, value in info.items(): - decoded = TAGS.get(tag, tag) - ret[decoded] = value - return ret - # tyhle funkce jsou tady jen kvůli starým migracím, které se na ně odkazují # až se ty migrace někdy squashnou, tak by mělo být možné funkce smazat def obrazek_filename_maly(): @@ -63,23 +48,14 @@ 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) - datum = models.DateTimeField('Datum pořízení fotografie', blank = True, null = True) galerie = models.ForeignKey('Galerie', blank=True, null=True) poradi = models.IntegerField('Pořadí', blank = True, null = True) def __unicode__(self): - return self.nazev + " -- " + unicode(self.obrazek_velky.name) + " (" + str(self.datum) + ")" + return self.nazev + " -- " + unicode(self.obrazek_velky.name) class Meta: verbose_name = 'Obrázek' verbose_name_plural = 'Obrázky' - ordering = ['datum'] - def save(self): - original = Image.open(self.obrazek_velky) - # vycteni EXIFu - exif = get_exif(original) - if exif['DateTimeOriginal']: - datum_ints = map(int, ":".join(exif['DateTimeOriginal'].split(' ')).split(":")) - self.datum = datetime(*datum_ints) - super(Obrazek, self).save() + ordering = ['nazev'] class Galerie(models.Model): diff --git a/galerie/views.py b/galerie/views.py index 9e23133f..46860810 100644 --- a/galerie/views.py +++ b/galerie/views.py @@ -38,7 +38,7 @@ def nahled(request, pk, soustredeni): if not request.user.is_staff: podgalerie = podgalerie.filter(zobrazit__lt=1) - obrazky = Obrazek.objects.filter(galerie = galerie).order_by('datum') + obrazky = Obrazek.objects.filter(galerie = galerie) preview = zobrazit(galerie, request) sourozenci = [] @@ -82,7 +82,7 @@ def detail(request, pk, fotka, soustredeni): galerie = get_object_or_404(Galerie, pk=pk) preview = zobrazit(galerie, request) obrazek = get_object_or_404(Obrazek, pk=fotka) - obrazky = galerie.obrazek_set.all().order_by('datum') + obrazky = galerie.obrazek_set.all() # vytvoreni a obslouzeni formulare if request.method == 'POST': From d289d165ef45f7c77076d7bd646e2409303eea65 Mon Sep 17 00:00:00 2001 From: Aneta Date: Thu, 3 Dec 2015 01:05:06 +0100 Subject: [PATCH 02/26] =?UTF-8?q?Oprava=20generov=C3=A1n=C3=AD=20TeXovsk?= =?UTF-8?q?=C3=A9=20v=C3=BDsledkovky.=20V=20models=20p=C5=99id=C3=A1na=20f?= =?UTF-8?q?ce=20pro=20=C5=99e=C5=A1itele=20inicial=5Fkrestni,=20ve=20views?= =?UTF-8?q?.py=20opraveno=20po=C5=99ad=C3=AD=20(2.-5.)=20pomoc=C3=AD=20uni?= =?UTF-8?q?codov=C3=A9=20poml=C4=8Dky.=20A.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/models.py | 3 ++ .../seminar/archiv/cislo_vysledkovka.tex | 35 +++---------------- seminar/views.py | 3 +- 3 files changed, 9 insertions(+), 32 deletions(-) diff --git a/seminar/models.py b/seminar/models.py index c33488f1..fbb2a9d5 100644 --- a/seminar/models.py +++ b/seminar/models.py @@ -185,6 +185,9 @@ class Resitel(SeminarModelBase): def plne_jmeno(self): return force_unicode(u'%s %s' % (self.jmeno, self.prijmeni)) + def inicial_krestni(self): + return force_unicode(u'%s.' % (self.jmeno[0])) + def __str__(self): return force_unicode(self.plne_jmeno()) diff --git a/seminar/templates/seminar/archiv/cislo_vysledkovka.tex b/seminar/templates/seminar/archiv/cislo_vysledkovka.tex index e988484c..f3a9d662 100644 --- a/seminar/templates/seminar/archiv/cislo_vysledkovka.tex +++ b/seminar/templates/seminar/archiv/cislo_vysledkovka.tex @@ -1,33 +1,6 @@ -\begin{longtable}{r|l|c|l|c - {% for p in problemy %} - @\hskip.5em}c {% endfor %} - |c|r|r} -\hline -& & & & \multicolumn{ {{ problemy|length }} }{c|}{\textbf{Úlohy}} & & \\ -\textbf{Poř.} & \textbf{Jméno} & \textbf{R.} & \raisebox{0.7mm}{$\sum_{-1}$} & -{% for p in problemy %} - {% if p.TYP_ULOHA %} - \textbf{ r{{ p.kod }} } & - {% else %} - \textbf{ t{{ p.kod }} } & - {% endif %} -{% endfor %} -\raisebox{0.7mm}{$\sum_0$} & -\raisebox{0.7mm}{$\sum_1$} \\ -\hline +\begin{longtable}{|r|l|c|r|{% for p in problemy %}c@{\hskip.5em}{% endfor %}|r|r|}\hline +& & & & \multicolumn{ {{ problemy|length }} }{c|}{\textbf{Úlohy}} & & \\\textbf{Poř.} & \textbf{Jméno} & \textbf{R.} & \raisebox{0.7mm}{$\sum_{-1}$} & {% for p in problemy %}{% if p.TYP_ULOHA %}\textbf{r{{p.kod}}} & {% else %}\textbf{t{{p.kod}}} & {% endif %}{% endfor %}\raisebox{0.7mm}{$\sum_0$} & \raisebox{0.7mm}{$\sum_1$} \\ \hline \endhead \hline -\endfoot - -{% for rv in vysledkovka %} - {{ rv.poradi }} & -{% if rv.resitel.titul %} - \titul{ {{ rv.titul }} } -{% endif %} - {{ rv.resitel.plne_jmeno }} & {{ rv.resitel.rocnik |default:"" }} & {{ rv.body_minule }} - {% for b in rv.body %} - {{ b }} & - {% endfor %} - {{ rv.body_celkem_rocnik |default:0 }} & {{ rv.body_celkem_minule }} \\ -{% endfor %} -\end{longtable} +\endfoot {% for rv in vysledkovka %} {{ rv.poradi }} & {% if rv.resitel.titul %} \titul{ {{ rv.titul }} } {% endif %} {{rv.resitel.inicial_krestni}} {{rv.resitel.prijmeni}} & {{ rv.resitel.rocnik |default:"" }} & {{ rv.body_minule }} & {% for b in rv.body_ulohy %}{{ b }} & {% endfor %} {{ rv.body_celkem_rocnik |default:0 }} & {{ rv.body_celkem_minule }} \\ +{% endfor %}\end{longtable} diff --git a/seminar/views.py b/seminar/views.py index c43799fd..54ed3e11 100644 --- a/seminar/views.py +++ b/seminar/views.py @@ -128,8 +128,9 @@ def sloupec_s_poradim(vysledky): poradi_l += ["{}.".format(lepsich_resitelu + 1)] # je-li účastníků se stejným počtem bodů víc, pořadí (rozsah X.-Y.) je jen u prvního else: - poradi_l += ["{}.–{}.".format(lepsich_resitelu + 1, lepsich_resitelu + len(skupina))] + [""] * (len(skupina)-1) + poradi_l += [u"{}. – {}.".format(lepsich_resitelu + 1, lepsich_resitelu + len(skupina))] + [""] * (len(skupina)-1) lepsich_resitelu += len(skupina) + #pomlcka je opravdu pomlcka v unicode!!dulezite pro vysledkovku v TeXu return poradi_l From 1f0ba770b3c585fac5df3ef6f129d563b6a54f1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Fri, 4 Dec 2015 14:34:51 +0100 Subject: [PATCH 03/26] =?UTF-8?q?Galerie:=20=C3=BApravy=20vzhledu=20a=20ma?= =?UTF-8?q?m-org-only=20blok=C5=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- galerie/templates/galerie/GalerieNahled.html | 15 +++- mamweb/static/css/mamweb.css | 18 ++++- .../soustredeni/seznam_soustredeni.html | 72 +++++++++---------- 3 files changed, 64 insertions(+), 41 deletions(-) diff --git a/galerie/templates/galerie/GalerieNahled.html b/galerie/templates/galerie/GalerieNahled.html index 9a26f101..bb475b50 100644 --- a/galerie/templates/galerie/GalerieNahled.html +++ b/galerie/templates/galerie/GalerieNahled.html @@ -6,6 +6,10 @@ Galerie {{galerie.nazev}} {% block content %} + {% if galerie.zobrazit > 0 %} +
+ {% endif %} +

{% for g in cesta %} {% if not forloop.last %} @@ -19,7 +23,7 @@ Galerie {{galerie.nazev}} {% if not obrazky %}
{% if galerie.titulni_obrazek %} - + {% endif %}
{% endif %} @@ -45,8 +49,8 @@ Galerie {{galerie.nazev}} {% if galerie.titulni_obrazek %} {% with galerie.titulni_obrazek.obrazek_maly as obrazek %} + width="{% widthratio obrazek.width 167 obrazek.width %}" + height="{% widthratio obrazek.width 167 obrazek.height %}" /> {% endwith %} {% endif %}
@@ -103,4 +107,9 @@ Galerie {{galerie.nazev}}
{% endif %} {% endif %} + + {% if galerie.zobrazit > 0 %} +

{# mam-org-only #} + {% endif %} + {% endblock content %} diff --git a/mamweb/static/css/mamweb.css b/mamweb/static/css/mamweb.css index 1daecacc..8b1ef07d 100644 --- a/mamweb/static/css/mamweb.css +++ b/mamweb/static/css/mamweb.css @@ -18,6 +18,15 @@ body { border: orange 2px dashed; } +.mam-org-only .mam-org-only { + border: 0px; +} + +li.mam-org-only { + padding: 3px 0px; + margin: -2px 0px; +} + table .border-r { border-right: solid 1px; } @@ -446,7 +455,8 @@ div.zadani_azad_termin { /* galerie */ /* velká fotka */ -.galerie .obrazek { +/* zmenšování spolu s oknem prohlížeče */ +.galerie .obrazek, .titulni_obrazek { max-width: 100%; height: auto; width: auto\9; /* ie8 */ @@ -482,7 +492,6 @@ div.zadani_azad_termin { .galerie { position: relative; text-align: center; - /*width: 100%;*/ margin: 20px auto 0 auto; } @@ -503,6 +512,11 @@ div.zadani_azad_termin { text-align: center; } +/* titulní obrázek hlavní galerie soustředění */ +.titulni_obrazek { + border: 1px solid black; +} + .galerie_nahledy{ /*margin: 1em 0;*/ margin: 0 auto 30px auto; diff --git a/seminar/templates/seminar/soustredeni/seznam_soustredeni.html b/seminar/templates/seminar/soustredeni/seznam_soustredeni.html index 121d19b0..f7bc73a8 100644 --- a/seminar/templates/seminar/soustredeni/seznam_soustredeni.html +++ b/seminar/templates/seminar/soustredeni/seznam_soustredeni.html @@ -21,47 +21,44 @@ {# Projdi vsechna soustredeni #} {% for soustredeni in object_list %} {# Kdyz je verejne -> zobraz #} - {% if soustredeni.verejne_db or user.is_authenticated %} - {% if not soustredeni.verejne_db and user.is_authenticated %} - Groups of user: {{user.groups.all}}
- - Toto soustředění není veřejné, vidíte ho jen proto, - že jste přihlášení.
+ {% if soustredeni.verejne_db or user.is_staff %} + {% if not soustredeni.verejne_db and user.is_staff %} +
+ {% endif %} {# misto soustredeni TODO upravit#} -

- {{soustredeni.get_typ_display}} - {{soustredeni.misto}} -

-
    -
  • - {{soustredeni.datum_zacatku}} – {{soustredeni.datum_konce}} -
  • - {# Zobrazeni odkazu na galerie #} - {% if soustredeni.galerie_set.all %} - {% for galerie in soustredeni.galerie_set.all %} - {% if galerie.zobrazit == 0 or user.is_staff %} +

    + {{soustredeni.get_typ_display}} + {{soustredeni.misto}} +

    +
    • - Fotogalerie - {# TODO kdyz je titulni obrazek, tak asi i titulni obrazek #} + {{soustredeni.datum_zacatku}} – {{soustredeni.datum_konce}}
    • + {# Zobrazeni odkazu na galerie #} + {% if soustredeni.galerie_set.all %} + {% for galerie in soustredeni.galerie_set.all %} + {% if galerie.zobrazit == 0 or user.is_staff %} +
    • 0 and user.is_staff %}class="mam-org-only"{% endif %}> + Fotogalerie + {# TODO kdyz je titulni obrazek, tak asi i titulni obrazek #} +
    • + {% endif %} + {% endfor %} + {% endif %} +
    + {% if user.is_staff %} + {% endif %} - {% endfor %} - {% endif %} -
- {% if user.is_staff %} - - {% endif %} - {# popis soustredeni #} - {% if soustredeni.text %} - {% autoescape off %}{{soustredeni.text}}{% endautoescape %} - {% endif %} + {# popis soustredeni #} + {% if soustredeni.text %} + {% autoescape off %}{{soustredeni.text}}{% endautoescape %} + {% endif %} {% if user.is_authenticated %} {# Účastníci #}

Soustředění se zúčastnili tito účastníci:

@@ -73,9 +70,12 @@ {% endfor %} {% endif %} + {% if not soustredeni.verejne_db and user.is_staff %} +
{# class="mam-org-only" #} + {% endif %} {% endif %} - {% empty %} - Žádná soustředění zatím neproběhla! + {% empty %} + Žádná soustředění zatím neproběhla! {% endfor %} {% endblock %} From 26b3cbba7f2c9a4611c80327b39ec22e44101bc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Fri, 4 Dec 2015 16:03:15 +0100 Subject: [PATCH 04/26] =?UTF-8?q?Admin:=20filtrov=C3=A1n=C3=AD=20zadan?= =?UTF-8?q?=C3=BDch=20probl=C3=A9m=C5=AF=20dle=20zam=C4=9B=C5=99en=C3=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/admin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seminar/admin.py b/seminar/admin.py index 3a680fc4..b86d933a 100644 --- a/seminar/admin.py +++ b/seminar/admin.py @@ -334,7 +334,7 @@ create_modeladmin(ProblemNavrhAdmin, Problem, 'ProblemNavrh', verbose_name=u'Pro class ProblemZadanyAdmin(ProblemAdmin): list_display = ['nazev', 'typ', 'autor', 'opravovatel', 'kod', 'cislo_zadani', 'pocet_reseni', 'verejne'] - list_filter = ['typ', 'cislo_zadani__cislo', 'cislo_zadani__rocnik'] + list_filter = ['typ', 'zamereni', 'cislo_zadani__cislo', 'cislo_zadani__rocnik'] inlines = [ReseniKProblemuInline] def get_queryset(self, request): From 607a94ff8cf31092adcc8414e856a4009b5d791e Mon Sep 17 00:00:00 2001 From: "Bc. Petr Pecha" Date: Fri, 4 Dec 2015 20:03:06 +0100 Subject: [PATCH 05/26] Nezverejnuj odpocet, pokud neni jeste verejne cislo --- seminar/templates/seminar/titulnistrana.html | 16 +--------------- seminar/views.py | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/seminar/templates/seminar/titulnistrana.html b/seminar/templates/seminar/titulnistrana.html index c6c1a522..ae949d7e 100644 --- a/seminar/templates/seminar/titulnistrana.html +++ b/seminar/templates/seminar/titulnistrana.html @@ -22,23 +22,9 @@ M&M je korespondeční seminář. Několikrát do roka zdarma vydáváme ča

Do konce odeslání řešení zbývá:
{{ted|timesince:dead}}

- - - -
{% endif %} + {# Novinky #}

Novinky

{% include 'seminar/novinky.html' %} diff --git a/seminar/views.py b/seminar/views.py index 54ed3e11..e122d163 100644 --- a/seminar/views.py +++ b/seminar/views.py @@ -72,16 +72,16 @@ class TitulniStranaView(generic.ListView): context = super(TitulniStranaView, self).get_context_data(**kwargs) nastaveni = get_object_or_404(Nastaveni) cas_deadline = nastaveni.aktualni_cislo.datum_deadline - try: - rozdil_casu = datetime.combine(cas_deadline, datetime.max.time()) \ - - datetime.now() - context['cas_do_konce_dni'] = rozdil_casu.days - context['cas_do_konce_hodin'] = rozdil_casu.seconds / 3600 - context['cas_do_konce_minut'] = (rozdil_casu.seconds / 60) % 60 - context['cas_do_konce_sekund'] = rozdil_casu.seconds % 60 - context['dead'] = datetime.combine(cas_deadline, datetime.max.time()) - context['ted'] = datetime.now() - except: + # Pokud neni zverejnene cislo nezverejnuj odpocet + if nastaveni.aktualni_cislo.verejne(): + # pokus se zjistit termin odeslani a pokud neni zadany, + # nezverejnuj odpocet + try: + context['dead'] = datetime.combine(cas_deadline, datetime.max.time()) + context['ted'] = datetime.now() + except: + context['dead'] = None + else: context['dead'] = None return context From 7599522a13dec758b4e6ecef91ca33c18f6bd3b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Fri, 4 Dec 2015 20:09:42 +0100 Subject: [PATCH 06/26] =?UTF-8?q?Admin:=20=C3=BApravy=20galeri=C3=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * tlačítko uložit nahoře * náhled obrázku ve volbě titulní fotky * řazení galerií podle (rodiče, pořadí) --- galerie/admin.py | 27 +++++++++----- galerie/autocomplete_light_registry.py | 49 ++++++++++++++++++++++++++ galerie/models.py | 6 ++++ 3 files changed, 74 insertions(+), 8 deletions(-) create mode 100644 galerie/autocomplete_light_registry.py diff --git a/galerie/admin.py b/galerie/admin.py index 4f95c951..1441ce09 100644 --- a/galerie/admin.py +++ b/galerie/admin.py @@ -3,6 +3,9 @@ from galerie.models import Obrazek, Galerie from django.contrib import admin from django.http import HttpResponseRedirect +from django import forms +from django.db import models +import autocomplete_light # akction @@ -27,17 +30,25 @@ def prepnout_fotogalerii_do_org_rezimu(modeladmin, request, queryset): 'Přepnout do režimu úprav (zneveřejní galerii)' class GalerieInline(admin.TabularInline): - model = Obrazek + model = Obrazek + fields = ['obrazek_velky', 'nazev', 'popis', 'obrazek_maly_tag'] + readonly_fields = ['nazev', 'obrazek_maly_tag'] + formfield_overrides = { + models.TextField: {'widget': forms.TextInput}, + } class ObrazekAdmin(admin.ModelAdmin): - list_display = ('obrazek_velky', 'nazev', 'popis') + list_display = ('obrazek_velky', 'nazev', 'popis', 'obrazek_maly_tag') -class GalerieAdmin(admin.ModelAdmin): - model = Galerie - fields = ('zobrazit', 'nazev', 'titulni_obrazek', 'popis', 'galerie_up', 'soustredeni', 'poradi') - list_display = ('nazev', 'pk', 'datum_zmeny', 'zobrazit', 'soustredeni') - inlines = [GalerieInline] - actions = [zverejnit_fotogalerii, prepnout_fotogalerii_do_org_rezimu] +class GalerieAdmin(admin.ModelAdmin): + form = autocomplete_light.modelform_factory(Galerie, autocomplete_fields=['titulni_obrazek'], fields=['titulni_obrazek']) + model = Galerie + fields = ('zobrazit', 'nazev', 'titulni_obrazek', 'popis', 'galerie_up', 'soustredeni', 'poradi') + list_display = ('nazev', 'pk', 'poradi', 'datum_zmeny', 'zobrazit', 'soustredeni') + inlines = [GalerieInline] + actions = [zverejnit_fotogalerii, prepnout_fotogalerii_do_org_rezimu] + save_on_top = True + ordering = ['galerie_up__nazev', 'poradi'] admin.site.register(Obrazek, ObrazekAdmin) admin.site.register(Galerie, GalerieAdmin) diff --git a/galerie/autocomplete_light_registry.py b/galerie/autocomplete_light_registry.py new file mode 100644 index 00000000..7b624d20 --- /dev/null +++ b/galerie/autocomplete_light_registry.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- + +from __future__ import unicode_literals + +import autocomplete_light + +from models import Obrazek, Galerie +from views import cesta_od_korene + + +class ObrazekAutocomplete(autocomplete_light.AutocompleteModelBase): + + model = Obrazek + search_fields = ['nazev', 'popis'] + split_words = True + limit_choices = 15 + attrs = { + # This will set the input placeholder attribute: + 'placeholder': u'Obrázek', + # This will set the yourlabs.Autocomplete.minimumCharacters + # options, the naming conversion is handled by jQuery + 'data-autocomplete-minimum-characters': 1, + } + + choice_html_format = ''' + + + {} + {} + + + ''' + + def choice_label(self, obrazek): + cesta = "/".join(g.nazev for g in cesta_od_korene(obrazek.galerie)) + popis = "{}
".format(obrazek.popis) if obrazek.popis else "" + return '{}
{}{}'.format(obrazek.nazev, popis, cesta) + + def choice_html(self, obrazek): + """Vrátí kus html i s obrázkem, které se pak ukazuje v nabídce""" + return self.choice_html_format.format(self.choice_value(obrazek), + obrazek.obrazek_maly_tag(), self.choice_label(obrazek)) + + widget_attrs={ + 'data-widget-maximum-values': 15, + 'class': 'modern-style', + } + +autocomplete_light.register(ObrazekAutocomplete) diff --git a/galerie/models.py b/galerie/models.py index 9f3b1478..4c08c4f2 100644 --- a/galerie/models.py +++ b/galerie/models.py @@ -56,6 +56,12 @@ class Obrazek(models.Model): verbose_name = 'Obrázek' verbose_name_plural = 'Obrázky' ordering = ['nazev'] + + def obrazek_maly_tag(self): + return u''.format(self.obrazek_maly.url) + obrazek_maly_tag.short_description = "Náhled" + obrazek_maly_tag.allow_tags = True + class Galerie(models.Model): From 5be011652d987452e0448b0326c232e723eff15e Mon Sep 17 00:00:00 2001 From: "Tomas \"Jethro\" Pokorny" Date: Sun, 6 Dec 2015 18:56:56 +0100 Subject: [PATCH 07/26] Orgovksy odkaz na obalky. --- seminar/templates/seminar/archiv/cislo.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/seminar/templates/seminar/archiv/cislo.html b/seminar/templates/seminar/archiv/cislo.html index 2978cc84..50d50c5a 100644 --- a/seminar/templates/seminar/archiv/cislo.html +++ b/seminar/templates/seminar/archiv/cislo.html @@ -27,6 +27,12 @@ {% endfor %} + {% if user.is_staff %} + + {% endif %} + {% if cislo.verejna_vysledkovka %}

Výsledkovka

{% else %} From 09149f6fc9edc356f11b05fc6ceee9ad82e4bde1 Mon Sep 17 00:00:00 2001 From: "Tomas \"Jethro\" Pokorny" Date: Sun, 6 Dec 2015 19:25:31 +0100 Subject: [PATCH 08/26] Odkaz na tituly ze stranky cisla. --- seminar/templates/seminar/archiv/cislo.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/seminar/templates/seminar/archiv/cislo.html b/seminar/templates/seminar/archiv/cislo.html index 50d50c5a..a398a6cb 100644 --- a/seminar/templates/seminar/archiv/cislo.html +++ b/seminar/templates/seminar/archiv/cislo.html @@ -29,7 +29,11 @@ {% if user.is_staff %}
- Obálky (PDF) +

Orgovské odkazy

+
{% endif %} From 96161c49743ba41ee532dda38d3721c7b1ffa8ee Mon Sep 17 00:00:00 2001 From: "Tomas \"Jethro\" Pokorny" Date: Sun, 6 Dec 2015 23:32:25 +0100 Subject: [PATCH 09/26] Funkce pro aktualni a aktivni resitele. --- seminar/views.py | 47 +++++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/seminar/views.py b/seminar/views.py index 54ed3e11..84890ea8 100644 --- a/seminar/views.py +++ b/seminar/views.py @@ -7,6 +7,7 @@ from django.core.urlresolvers import reverse from django.views import generic from django.utils.translation import ugettext as _ from django.http import Http404 +from django.db.models import Q from .models import Problem, Cislo, Reseni, Nastaveni, Rocnik, Soustredeni, Organizator, Resitel, Novinky, Soustredeni_Ucastnici from .models import VysledkyZaCislo, VysledkyKCisluZaRocnik, VysledkyKCisluOdjakziva @@ -343,28 +344,42 @@ class RocnikVysledkovkaView(RocnikView): ### Generovani obalek class CisloObalkyStruct: - resitele = None rocnik = None - problemy = None - -def cisloObalkyView(request,rocnik,cislo): + cisla = None + + +# Vraci QuerySet aktualnich resitelu = nekdy neco poslali, ale jeste neodmaturovali +def aktualniResitele(rocnik): + letos = Rocnik.objects.filter(rocnik = rocnik).first() + return Resitel.objects.filter(rok_maturity__gt = letos.prvni_rok) +# # ALERT: pokud nekdo nema vypleny rok maturity, tak neni aktualni, protoze Karel Tesar a jini +# return Resitel.objects.filter(Q(rok_maturity__gt = letos.prvni_rok)|Q(rok_maturity = None)) + +# Vraci QuerySet aktivnich resitelu = +# jeste neodmaturovali && +# (pokud je aktualni cislo mensi nez 3, pak (letos || loni) neco poslali +# jinak letos neco poslali) +def aktivniResitele(rocnik,cislo): letos = CisloObalkyStruct() loni = CisloObalkyStruct() - letos.rocnik = Rocnik.objects.filter(rocnik = rocnik)[0] - loni.rocnik = Rocnik.objects.filter(rocnik = int(rocnik)-1)[0] - letos.problemy = Problem.objects.filter(cislo_zadani = Cislo.objects.filter(rocnik=letos.rocnik,cislo__lte = cislo)) - loni.problemy = Problem.objects.filter(cislo_zadani = Cislo.objects.filter(rocnik=loni.rocnik)) - letos.resitele = Resitel.objects.filter(reseni = Reseni.objects.filter(problem=letos.problemy)).distinct() - loni.resitele = Resitel.objects.filter(reseni = Reseni.objects.filter(problem=loni.problemy)).distinct() - - loni.resitele = loni.resitele.filter(rok_maturity__gt = letos.rocnik.prvni_rok) - + aktualni_resitele = aktualniResitele(rocnik) + + letos.rocnik = Rocnik.objects.filter(rocnik = rocnik).first() + loni.rocnik = Rocnik.objects.filter(rocnik = int(rocnik)-1).first() + letos.cisla = Cislo.objects.filter(rocnik=letos.rocnik,cislo__lte = cislo) + loni.cisla = Cislo.objects.filter(rocnik=loni.rocnik) if int(cislo) > 3: - resitele = letos.resitele + problemy = Problem.objects.filter(cislo_zadani = letos.cisla) else: - resitele = list(letos.resitele) + list(loni.resitele) - return obalkyView(request,resitele) + problemy = Problem.objects.filter(Q(cislo_zadani = letos.cisla)|Q(cislo_zadani=loni.cisla)) + resitele = aktualni_resitele.filter(reseni = Reseni.objects.filter(problem=problemy)).distinct() + + return resitele + + +def cisloObalkyView(request,rocnik,cislo): + return obalkyView(request,aktivniResitele(rocnik,cislo)) def obalkyView(request,resitele): From a2c333241badad6271f653ba7e95d8fd80257546 Mon Sep 17 00:00:00 2001 From: Aneta Date: Mon, 7 Dec 2015 22:41:12 +0100 Subject: [PATCH 10/26] =?UTF-8?q?Doupraven=C3=AD=20v=C3=BDsledkovky=20do?= =?UTF-8?q?=20funk=C4=8Dn=C3=ADho=20stavu.=20A.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/templates/seminar/archiv/cislo_vysledkovka.tex | 9 ++++++--- seminar/views.py | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/seminar/templates/seminar/archiv/cislo_vysledkovka.tex b/seminar/templates/seminar/archiv/cislo_vysledkovka.tex index f3a9d662..d961d39f 100644 --- a/seminar/templates/seminar/archiv/cislo_vysledkovka.tex +++ b/seminar/templates/seminar/archiv/cislo_vysledkovka.tex @@ -1,6 +1,9 @@ +\setlength{\tabcolsep}{3pt} \begin{longtable}{|r|l|c|r|{% for p in problemy %}c@{\hskip.5em}{% endfor %}|r|r|}\hline -& & & & \multicolumn{ {{ problemy|length }} }{c|}{\textbf{Úlohy}} & & \\\textbf{Poř.} & \textbf{Jméno} & \textbf{R.} & \raisebox{0.7mm}{$\sum_{-1}$} & {% for p in problemy %}{% if p.TYP_ULOHA %}\textbf{r{{p.kod}}} & {% else %}\textbf{t{{p.kod}}} & {% endif %}{% endfor %}\raisebox{0.7mm}{$\sum_0$} & \raisebox{0.7mm}{$\sum_1$} \\ \hline +&&&&\multicolumn{ {{ problemy|length}} }{c|}{\textbf{Úlohy}}&&\\\textbf{Poř.}&\textbf{Jméno}&\textbf{R.}&\raisebox{0.7mm}{$\sum_{-1}$}&{% for p in problemy %}{% if p.typ == "uloha" %}\textbf{r{{p.kod}}}&{% elif p.typ = "tema" %}\textbf{t{{p.kod}}}&{% else %}\textbf{ {{p.kod}} }&{% endif %}{% endfor %}\raisebox{0.7mm}{$\sum_0$}&\raisebox{0.7mm}{$\sum_1$}\\\hline \endhead \hline -\endfoot {% for rv in vysledkovka %} {{ rv.poradi }} & {% if rv.resitel.titul %} \titul{ {{ rv.titul }} } {% endif %} {{rv.resitel.inicial_krestni}} {{rv.resitel.prijmeni}} & {{ rv.resitel.rocnik |default:"" }} & {{ rv.body_minule }} & {% for b in rv.body_ulohy %}{{ b }} & {% endfor %} {{ rv.body_celkem_rocnik |default:0 }} & {{ rv.body_celkem_minule }} \\ -{% endfor %}\end{longtable} +\endfoot +{% for rv in vysledkovka %}{{rv.poradi}}&{% if rv.titul %}\titul{ {{ rv.titul}}}{% endif %}{{rv.resitel.inicial_krestni}}{{rv.resitel.prijmeni}}&{{rv.resitel.rocnik|default:""}}&{{rv.body_celkem_odjakziva}}&{% for b in rv.body_ulohy %}{{b}}&{% endfor %}{{rv.body_cislo}}&{{rv.body_celkem_rocnik|default:0}}\\ +{% endfor %} +\end{longtable} diff --git a/seminar/views.py b/seminar/views.py index 54ed3e11..5a11f42a 100644 --- a/seminar/views.py +++ b/seminar/views.py @@ -294,6 +294,7 @@ class CisloView(generic.DetailView): v.poradi = poradi v.body_celkem_rocnik = v.body v.body_celkem_odjakziva = VysledkyKCisluOdjakziva.objects.get(resitel=v.resitel, cislo=context['cislo']).body + v.resitel.rocnik = v.resitel.rocnik(v.cislo.rocnik) # je tady '', aby se nezobrazovala 0, pokud se řešitel o řešení úlohy ani nepokusil v.body_ulohy = [''] * len(problemy) From 7196b5512dfc9a5514be9655c6addf39b4191004 Mon Sep 17 00:00:00 2001 From: Aneta Date: Tue, 8 Dec 2015 14:43:37 +0100 Subject: [PATCH 11/26] Snad uz finalni oprava vysledkovky. A. --- seminar/templates/seminar/archiv/cislo_vysledkovka.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seminar/templates/seminar/archiv/cislo_vysledkovka.tex b/seminar/templates/seminar/archiv/cislo_vysledkovka.tex index d961d39f..619b30e1 100644 --- a/seminar/templates/seminar/archiv/cislo_vysledkovka.tex +++ b/seminar/templates/seminar/archiv/cislo_vysledkovka.tex @@ -1,6 +1,6 @@ \setlength{\tabcolsep}{3pt} \begin{longtable}{|r|l|c|r|{% for p in problemy %}c@{\hskip.5em}{% endfor %}|r|r|}\hline -&&&&\multicolumn{ {{ problemy|length}} }{c|}{\textbf{Úlohy}}&&\\\textbf{Poř.}&\textbf{Jméno}&\textbf{R.}&\raisebox{0.7mm}{$\sum_{-1}$}&{% for p in problemy %}{% if p.typ == "uloha" %}\textbf{r{{p.kod}}}&{% elif p.typ = "tema" %}\textbf{t{{p.kod}}}&{% else %}\textbf{ {{p.kod}} }&{% endif %}{% endfor %}\raisebox{0.7mm}{$\sum_0$}&\raisebox{0.7mm}{$\sum_1$}\\\hline +& & & & \multicolumn{ {{ problemy|length}} }{c|}{\textbf{Úlohy}} & & \\\textbf{Poř.}& \textbf{Jméno}& \textbf{R.}& \raisebox{0.7mm}{$\sum_{-1}$}& {% for p in problemy %}{% if p.typ == "uloha" %}\textbf{r{{p.kod}}}&{% elif p.typ = "tema" %}\textbf{t{{p.kod}}}&{% else %}\textbf{ {{p.kod}} }&{% endif %}{% endfor %}\raisebox{0.7mm}{$\sum_0$}&\raisebox{0.7mm}{$\sum_1$}\\\hline \endhead \hline \endfoot From c1c71c3073889f194e85ca7d52da019b27ce7b1d Mon Sep 17 00:00:00 2001 From: "Bc. Petr Pecha" Date: Wed, 9 Dec 2015 14:34:07 +0100 Subject: [PATCH 12/26] Aktualni zadani | Upravy v zobrazeni 1) Nezverejnuj nezverejnene ulohy 2) Pro organizatory zverejnuj nezverejnene ulohy --- .../seminar/zadani/AktualniVysledkovka.html | 2 +- .../templates/seminar/zadani/AktualniZadani.html | 15 +++++++++++++-- seminar/views.py | 2 ++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/seminar/templates/seminar/zadani/AktualniVysledkovka.html b/seminar/templates/seminar/zadani/AktualniVysledkovka.html index 9996b567..8e0898ca 100644 --- a/seminar/templates/seminar/zadani/AktualniVysledkovka.html +++ b/seminar/templates/seminar/zadani/AktualniVysledkovka.html @@ -19,7 +19,7 @@ {% if vysledkovka %} {% include "seminar/vysledkovka_rocnik.html" %} {% else %} - V tomto ročníku zatím žádné výsledky nejsou + V tomto ročníku zatím žádné výsledky nejsou. {% endif %} {% if user.is_staff and vysledkovka_s_neverejnymi %} diff --git a/seminar/templates/seminar/zadani/AktualniZadani.html b/seminar/templates/seminar/zadani/AktualniZadani.html index ff6c3cd3..a9f84a64 100644 --- a/seminar/templates/seminar/zadani/AktualniZadani.html +++ b/seminar/templates/seminar/zadani/AktualniZadani.html @@ -13,7 +13,11 @@ {% block content %}
- {% with nastaveni.aktualni_cislo as ac %} +{% with nastaveni.aktualni_cislo as ac %} + +{# Zobrazovani neverejnych zadani jen organizatorum #} +{% if user.is_staff or verejne %} +{% if user.is_staff and not verejne %}
{% endif %} {% if ac.zadane_problemy.all %}
@@ -45,6 +49,12 @@ Aktuálně nejsou zadané žádné úlohy k řešení. {% endfor %} +{% if user.is_staff and not verejne%}
{% endif %} +{% else %} +

Aktuálně nejsou zveřejněny žádné úlohy

+{% endif %} + +

Témata

    {% for problem in temata %} @@ -56,7 +66,8 @@ Aktuálně nejsou zadána žádná témata k řešení. {% endfor %}
- {% endwith %} + +{% endwith %}
{% endblock content %} diff --git a/seminar/views.py b/seminar/views.py index bc43d6fc..4bef203a 100644 --- a/seminar/views.py +++ b/seminar/views.py @@ -30,6 +30,7 @@ def verejna_temata(rocnik): def AktualniZadaniView(request): nastaveni = get_object_or_404(Nastaveni) + verejne = nastaveni.aktualni_cislo.verejne() problemy = Problem.objects.filter(cislo_zadani=nastaveni.aktualni_cislo).filter(stav = 'zadany') ulohy = problemy.filter(typ = 'uloha').order_by('kod') serialy = problemy.filter(typ = 'serial').order_by('kod') @@ -38,6 +39,7 @@ def AktualniZadaniView(request): {'nastaveni': nastaveni, 'jednorazove_problemy': jednorazove_problemy, 'temata': verejna_temata(nastaveni.aktualni_rocnik), + 'verejne': verejne, }, ) From d6b419f03755ff4ecc880a54e5c305852e765bfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Sun, 13 Dec 2015 21:46:44 +0100 Subject: [PATCH 13/26] =?UTF-8?q?CKEditor:=20opraveno=20nastaven=C3=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mamweb/settings_common.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/mamweb/settings_common.py b/mamweb/settings_common.py index d48a0938..67072e59 100644 --- a/mamweb/settings_common.py +++ b/mamweb/settings_common.py @@ -157,6 +157,7 @@ CKEDITOR_IMAGE_BACKEND = 'pillow' #CKEDITOR_JQUERY_URL = '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js' CKEDITOR_CONFIGS = { 'default': { + 'entities': False, 'toolbar': [ ['Source', 'ShowBlocks', '-', 'Maximize'], ['Bold', 'Italic', 'Subscript', 'Superscript', '-', 'RemoveFormat'], @@ -235,12 +236,3 @@ LOGGING = { # MaM specific SEMINAR_RESENI_DIR = os.path.join(BASE_DIR, 'media', 'reseni') - - -CKEDITOR_CONFIGS = { - 'default': { - 'entities': False - } -} - - From e3e77dc852629dc7aee48493a578a82880a86f3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Wed, 16 Dec 2015 20:38:00 +0100 Subject: [PATCH 14/26] =?UTF-8?q?Co=20je=20M&M:=20p=C5=99id=C3=A1n=20odkaz?= =?UTF-8?q?=20na=20odm=C4=9Bny?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mamweb/templates/flatpages/default.html | 4 ++++ seminar/templates/seminar/cojemam/submenu.html | 1 + 2 files changed, 5 insertions(+) diff --git a/mamweb/templates/flatpages/default.html b/mamweb/templates/flatpages/default.html index e3f03920..b5d2d24d 100644 --- a/mamweb/templates/flatpages/default.html +++ b/mamweb/templates/flatpages/default.html @@ -22,6 +22,10 @@ {% with "jak-resit" as selected %} {% include "seminar/cojemam/submenu.html" %} {% endwith %} + {% elif "odmeny" in flatpage.url %} + {% with "odmeny" as selected %} + {% include "seminar/cojemam/submenu.html" %} + {% endwith %} {% elif "FAQ" in flatpage.url %} {% with "FAQ" as selected %} {% include "seminar/cojemam/submenu.html" %} diff --git a/seminar/templates/seminar/cojemam/submenu.html b/seminar/templates/seminar/cojemam/submenu.html index 18b6901a..f7e64f3b 100644 --- a/seminar/templates/seminar/cojemam/submenu.html +++ b/seminar/templates/seminar/cojemam/submenu.html @@ -4,6 +4,7 @@ From 23aede313e24c0d961e1bb00a9330bb15920fea0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Thu, 17 Dec 2015 23:25:54 +0100 Subject: [PATCH 15/26] =?UTF-8?q?Galerie:=20fix=20nahr=C3=A1v=C3=A1n=C3=AD?= =?UTF-8?q?=20fotek=20p=C5=99es=20admin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Obrázek si při save() vyplní název * obrazek_filename() nespoléhá na to, že je každá galerie pod nějakým soustředěním --- galerie/models.py | 72 +++++++++++++++++++++++++++++------------------ 1 file changed, 45 insertions(+), 27 deletions(-) diff --git a/galerie/models.py b/galerie/models.py index 4c08c4f2..3cc4b682 100644 --- a/galerie/models.py +++ b/galerie/models.py @@ -31,36 +31,54 @@ def obrazek_filename_velky(): def obrazek_filename(self, filename): gal = self.galerie cislo_gal = force_unicode(gal.pk) - cesta = "" - while(not gal.soustredeni): + + # najdi kořenovou galerii + while (gal.galerie_up): gal = gal.galerie_up - return os.path.join('Galerie', "soustredeni_" + force_unicode(gal.soustredeni.pk), "galerie_" + cislo_gal, "velky", force_unicode(self.nazev)) + + # soustředění je v cestě jen pokud galerie pod nějaké patří + cesta = ( + ['Galerie'] + + (["soustredeni_" + force_unicode(gal.soustredeni.pk)] if gal.soustredeni else []) + + ["galerie_" + cislo_gal, force_unicode(self.nazev)] + ) + + return os.path.join(*cesta) class Obrazek(models.Model): - obrazek_velky = models.ImageField(upload_to=obrazek_filename, - help_text = "Lze vložit libovolně velký obrázek. Ideální je, aby alespoň jeden rozměr měl alespoň 500px.") - obrazek_stredni = ImageSpecField(source='obrazek_velky', - processors=[Transpose(Transpose.AUTO), ResizeToFit(900, 675, upscale=False)], - options={'quality': 95}) - obrazek_maly = ImageSpecField(source='obrazek_velky', - processors=[Transpose(Transpose.AUTO), ResizeToFit(167, 167, upscale=False)], - options={'quality': 95}) - 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) - poradi = models.IntegerField('Pořadí', blank = True, null = True) - def __unicode__(self): - return self.nazev + " -- " + unicode(self.obrazek_velky.name) - class Meta: - verbose_name = 'Obrázek' - verbose_name_plural = 'Obrázky' - ordering = ['nazev'] - - def obrazek_maly_tag(self): - return u''.format(self.obrazek_maly.url) - obrazek_maly_tag.short_description = "Náhled" - obrazek_maly_tag.allow_tags = True + obrazek_velky = models.ImageField(upload_to=obrazek_filename, + help_text = "Lze vložit libovolně velký obrázek. Ideální je, aby alespoň jeden rozměr měl alespoň 500px.") + obrazek_stredni = ImageSpecField(source='obrazek_velky', + processors=[Transpose(Transpose.AUTO), ResizeToFit(900, 675, upscale=False)], + options={'quality': 95}) + obrazek_maly = ImageSpecField(source='obrazek_velky', + processors=[Transpose(Transpose.AUTO), ResizeToFit(167, 167, upscale=False)], + options={'quality': 95}) + 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) + poradi = models.IntegerField('Pořadí', blank=True, null=True) + + def __unicode__(self): + return unicode(self.obrazek_velky.name) + + class Meta: + verbose_name = 'Obrázek' + verbose_name_plural = 'Obrázky' + ordering = ['nazev'] + + def obrazek_maly_tag(self): + return u''.format(self.obrazek_maly.url) + obrazek_maly_tag.short_description = "Náhled" + obrazek_maly_tag.allow_tags = True + + def save(self, *args, **kwargs): + # obrázek potřebuje název, protože se z něj generuje cesta pro jeho uložení + # (a pak se podle něj taky řadí) + if self.nazev is None: + self.nazev = os.path.basename(self.obrazek_velky.name) + super(Obrazek, self).save(*args, **kwargs) From ec6f988e517aa63008e52fe8a8a76ec94f223e64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Thu, 17 Dec 2015 23:46:23 +0100 Subject: [PATCH 16/26] =?UTF-8?q?GalerieNahled:=20title=20n=C3=A1hledu=20j?= =?UTF-8?q?e=20popis=20obr=C3=A1zku?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit a ne "Zobrazit tuto fotografii" --- galerie/templates/galerie/GalerieNahled.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/galerie/templates/galerie/GalerieNahled.html b/galerie/templates/galerie/GalerieNahled.html index bb475b50..8d4aa38f 100644 --- a/galerie/templates/galerie/GalerieNahled.html +++ b/galerie/templates/galerie/GalerieNahled.html @@ -78,7 +78,11 @@ Galerie {{galerie.nazev}} {% if obrazky %}
{% for obrazek in obrazky %} - From dbc5b84ce8e2040600fbcf9792a8bddc89630069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Fri, 18 Dec 2015 15:57:40 +0100 Subject: [PATCH 17/26] =?UTF-8?q?Galerie:=20drobn=C3=A9=20=C3=BApravy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * rozumnější zmenšování náhledu podgalerie * max 22 znaků z názvu podgalerie v náhledu, plný název v title --- galerie/templates/galerie/GalerieNahled.html | 24 +++++++++++++------- mamweb/static/css/mamweb.css | 8 +++++++ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/galerie/templates/galerie/GalerieNahled.html b/galerie/templates/galerie/GalerieNahled.html index 8d4aa38f..7d9313fc 100644 --- a/galerie/templates/galerie/GalerieNahled.html +++ b/galerie/templates/galerie/GalerieNahled.html @@ -43,18 +43,22 @@ Galerie {{galerie.nazev}} {% endif %} {% if podgalerie %} + {% with 22 as max_delka_nazvu %}
{% for galerie in podgalerie %} - + max_delka_nazvu %} + title="{{ galerie.nazev }}" + {% endif %} + class="podgalerie_nahled"> {% if galerie.titulni_obrazek %} - {% with galerie.titulni_obrazek.obrazek_maly as obrazek %} - - {% endwith %} + {% with galerie.titulni_obrazek.obrazek_maly as obrazek %} + + {% endwith %} {% endif %} -
- {{ galerie }} +
+ {{ galerie|truncatechars:max_delka_nazvu }}
{% if user.is_staff and galerie.zobrazit > 0 %} @@ -66,6 +70,7 @@ Galerie {{galerie.nazev}} {% endif %} {% endfor %}
+ {% endwith %} {% endif %} {% endif %} {% if user.is_staff and galerie.zobrazit > 0 %} @@ -84,6 +89,9 @@ Galerie {{galerie.nazev}} {% endif %} href="./{{obrazek.pk}}#nahoru" class="galerie_nahled"> diff --git a/mamweb/static/css/mamweb.css b/mamweb/static/css/mamweb.css index 8b1ef07d..a8f48643 100644 --- a/mamweb/static/css/mamweb.css +++ b/mamweb/static/css/mamweb.css @@ -613,6 +613,14 @@ div.zadani_azad_termin { .podgalerie_nahled img { margin-top: 20px; margin-bottom: 15px; + max-height: 125px; + max-width: 167px; +} + +.podgalerie_nahled .nazev_galerie { + position: absolute; + width: 100%; + top: 160px; } /* plus a minus tlacitka */ From 62e7f1dfbc334f9cee0444b989de02994b79a661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Sat, 19 Dec 2015 23:11:50 +0100 Subject: [PATCH 18/26] =?UTF-8?q?Fix:=20Probl=C3=A9m:=20jen=20orgov=C3=A9?= =?UTF-8?q?=20si=20mohou=20zobrazit=20n=C3=A1vrh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/templates/seminar/archiv/problem.html | 2 +- .../templates/seminar/archiv/problem_uloha_tema.html | 10 +++------- seminar/views.py | 7 +++++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/seminar/templates/seminar/archiv/problem.html b/seminar/templates/seminar/archiv/problem.html index 67071dea..6fdc5fac 100644 --- a/seminar/templates/seminar/archiv/problem.html +++ b/seminar/templates/seminar/archiv/problem.html @@ -3,7 +3,7 @@ {% load comments %} {% block content %} -
+
{% block problem %} {% endblock %} diff --git a/seminar/templates/seminar/archiv/problem_uloha_tema.html b/seminar/templates/seminar/archiv/problem_uloha_tema.html index 12ee40ac..bd68a6fb 100644 --- a/seminar/templates/seminar/archiv/problem_uloha_tema.html +++ b/seminar/templates/seminar/archiv/problem_uloha_tema.html @@ -8,14 +8,10 @@ {% if problem.cislo_zadani %}

Zadáno v čísle {{ problem.cislo_zadani.kod }}. - {% if problem.cislo_reseni %} -

Řešeno v čísle {{ problem.cislo_reseni.kod }}. - {% endif %} - {% else %} - {# TODO ? #} -

Problém {{ problem.nazev }}

{% endif %} - + {% if problem.cislo_reseni %} +

Řešeno v čísle {{ problem.cislo_reseni.kod }}. + {% endif %}

Zadání

{{ problem.text_zadani |safe }} diff --git a/seminar/views.py b/seminar/views.py index 4bef203a..93945778 100644 --- a/seminar/views.py +++ b/seminar/views.py @@ -1,9 +1,9 @@ # coding:utf-8 from django.shortcuts import get_object_or_404, render -from django.http import HttpResponseRedirect -from django.http import HttpResponse +from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidden from django.core.urlresolvers import reverse +from django.core.exceptions import PermissionDenied from django.views import generic from django.utils.translation import ugettext as _ from django.http import Http404 @@ -235,11 +235,14 @@ class ProblemView(generic.DetailView): def get_context_data(self, **kwargs): context = super(ProblemView, self).get_context_data(**kwargs) + if not context['problem'].verejne() and not self.request.user.is_staff: + raise PermissionDenied() if context['problem'].typ == Problem.TYP_RES_CLANEK: context['reseni'] = Reseni.objects.filter(problem=context['problem']).select_related('resitel').order_by('resitel__prijmeni') return context + class RadekVysledkovky(object): pass From d0846dbca0d43d96128c09ee5860039be5166e29 Mon Sep 17 00:00:00 2001 From: "Bc. Petr Pecha" Date: Tue, 22 Dec 2015 15:22:40 +0100 Subject: [PATCH 19/26] Pridani organizatoru k soustredeni (Migrace) --- seminar/admin.py | 17 ++- seminar/autocomplete_light_registry.py | 34 +++++- .../migrations/0036_add_org_to_soustredeni.py | 36 ++++++ seminar/models.py | 107 +++++++++++------- 4 files changed, 153 insertions(+), 41 deletions(-) create mode 100644 seminar/migrations/0036_add_org_to_soustredeni.py diff --git a/seminar/admin.py b/seminar/admin.py index b86d933a..8fd5aa61 100644 --- a/seminar/admin.py +++ b/seminar/admin.py @@ -11,7 +11,7 @@ from django.db import models from django.contrib.auth.models import User -from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni, PrilohaReseni, Nastaveni, Soustredeni, Soustredeni_Ucastnici, Novinky, Organizator +from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni, PrilohaReseni, Nastaveni, Soustredeni, Soustredeni_Ucastnici, Soustredeni_Organizatori, Novinky, Organizator import autocomplete_light @@ -163,6 +163,19 @@ class Soustredeni_UcastniciInline(admin.TabularInline): qs = super(Soustredeni_UcastniciInline, self).get_queryset(request) return qs.select_related('resitel', 'soustredeni') +class Soustredeni_OrganizatoriInline(admin.TabularInline): + form = autocomplete_light.modelform_factory(Soustredeni_Organizatori, autocomplete_fields=['organizator'], fields=['organizator'],) + model = Soustredeni_Organizatori + fields = ['organizator', 'poznamka', ] + extra = 0 + formfield_overrides = { + models.TextField: {'widget': forms.TextInput}, + } + + def get_queryset(self, request): + qs = super(Soustredeni_OrganizatoriInline, self).get_queryset(request) + return qs.select_related('organizator', 'soustredeni') + ### Resitel class ResitelAdmin(VersionAdmin): @@ -362,7 +375,7 @@ class SoustredeniAdmin(VersionAdmin): (u'Data', {'fields': ['datum_zacatku', 'datum_konce']}), ] list_display = ['rocnik', 'misto', 'datum_zacatku', 'typ', 'exportovat', 'verejne'] - inlines = [Soustredeni_UcastniciInline] + inlines = [Soustredeni_UcastniciInline, Soustredeni_OrganizatoriInline] list_filter = ['typ', 'rocnik'] view_on_site = Soustredeni.verejne_url actions = [ diff --git a/seminar/autocomplete_light_registry.py b/seminar/autocomplete_light_registry.py index c7762054..76b9f6ba 100644 --- a/seminar/autocomplete_light_registry.py +++ b/seminar/autocomplete_light_registry.py @@ -2,7 +2,7 @@ import autocomplete_light -from models import Skola, Resitel, Problem +from models import Skola, Resitel, Problem, Organizator from taggit.models import Tag @@ -64,6 +64,38 @@ class ResitelAutocomplete(autocomplete_light.AutocompleteModelBase): autocomplete_light.register(ResitelAutocomplete) +class OrganizatorAutocomplete(autocomplete_light.AutocompleteModelBase): + + model = Organizator + + search_fields=['user__first_name', 'user__last_name', 'prezdivka'] + + split_words = False + + limit_choices = 15 + + def choice_label(self, organizator): + return u"%s '%s' %s" % (organizator.user.first_name, + organizator.prezdivka, + organizator.user.last_name) + + attrs={ + # This will set the input placeholder attribute: + 'placeholder': u'Organizátor', + # This will set the yourlabs.Autocomplete.minimumCharacters + # options, the naming conversion is handled by jQuery + 'data-autocomplete-minimum-characters': 1, + } + + widget_attrs={ + 'data-widget-maximum-values': 15, + # Enable modern-style widget ! + 'class': 'modern-style', + } + +autocomplete_light.register(OrganizatorAutocomplete) + + class ProblemAutocomplete(autocomplete_light.AutocompleteModelBase): diff --git a/seminar/migrations/0036_add_org_to_soustredeni.py b/seminar/migrations/0036_add_org_to_soustredeni.py new file mode 100644 index 00000000..cd6a2aed --- /dev/null +++ b/seminar/migrations/0036_add_org_to_soustredeni.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0035_django_imagekit'), + ] + + operations = [ + migrations.CreateModel( + name='Soustredeni_Organizatori', + 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')), + ], + options={ + 'ordering': ['soustredeni', 'organizator'], + 'db_table': 'seminar_soustredeni_organizatori', + 'verbose_name': '\xda\u010dast organiz\xe1tor\u016f na soust\u0159ed\u011bn\xed', + 'verbose_name_plural': '\xda\u010dasti organiz\xe1tor\u016f na soust\u0159ed\u011bn\xed', + }, + bases=(models.Model,), + ), + migrations.AddField( + model_name='soustredeni', + name='organizatori', + field=models.ManyToManyField(help_text='Seznam organiz\xe1tor\u016f soust\u0159ed\u011bn\xed', to='seminar.Organizator', verbose_name='Organiz\xe1to\u0159i soust\u0159ed\u011bn\xed', through='seminar.Soustredeni_Organizatori'), + preserve_default=True, + ), + ] diff --git a/seminar/models.py b/seminar/models.py index fbb2a9d5..6674239f 100644 --- a/seminar/models.py +++ b/seminar/models.py @@ -579,6 +579,46 @@ class PrilohaReseni(SeminarModelBase): return force_unicode(self.soubor) +@reversion.register(ignore_duplicate_revisions=True) +@python_2_unicode_compatible +class Organizator(models.Model): + user = models.OneToOneField(settings.AUTH_USER_MODEL, verbose_name='Osoba', + help_text = 'Vyber účet spřažený s organizátorem.') + prezdivka = models.CharField('Přezdívka', max_length = 32, + null = True, blank = True) + organizuje_od_roku = models.IntegerField('Organizuje od roku', + null = True, blank = True) + organizuje_do_roku = models.IntegerField('Organizuje do roku', + null = True, blank = True) + studuje = models.CharField('Studium aj.', max_length = 256, + null = True, blank = True, + help_text="Např. 'Studuje Obecnou fyziku (Bc.), 3. ročník', " + "'Vystudovala Diskrétní modely a algoritmy (Mgr.)' nebo " + "'Přednáší na MFF'") + strucny_popis_organizatora = models.TextField('Stručný popis organizátora', + null = True, blank = True) + foto = ProcessedImageField(verbose_name='Fotografie organizátora', + upload_to='image_organizatori/velke/%Y/', null = True, blank = True, + help_text = 'Vlož fotografii organizátora o libovolné velikosti', + processors=[ + Transpose(Transpose.AUTO), + ResizeToFit(500, 500, upscale=False) + ], + options={'quality': 95}) + foto_male = ImageSpecField(source='foto', + processors=[ + ResizeToFit(200, 200, upscale=False) + ], + options={'quality': 95}) + + def __str__(self): + return str(self.user) + + class Meta: + verbose_name = 'Organizátor' + verbose_name_plural = 'Organizátoři' + + @reversion.register(ignore_duplicate_revisions=True) @python_2_unicode_compatible class Soustredeni(SeminarModelBase): @@ -608,6 +648,11 @@ class Soustredeni(SeminarModelBase): ucastnici = models.ManyToManyField(Resitel, verbose_name=u'účastníci soustředění', help_text=u'Seznam účastníků soustředění', through='Soustredeni_Ucastnici') + organizatori = models.ManyToManyField(Organizator, + verbose_name=u'Organizátoři soustředění', + help_text=u'Seznam organizátorů soustředění', + through='Soustredeni_Organizatori') + text = models.TextField(u'text k soustředění (HTML)', blank=True, default='') TYP_JARNI = 'jarni' @@ -659,6 +704,30 @@ class Soustredeni_Ucastnici(models.Model): return force_unicode(u'%s na %s' % (self.resitel, self.soustredeni, )) # NOTE: Poteciální DB HOG bez select_related +@reversion.register(ignore_duplicate_revisions=True) +@python_2_unicode_compatible +class Soustredeni_Organizatori(models.Model): + + class Meta: + db_table = 'seminar_soustredeni_organizatori' + verbose_name = u'Účast organizátorů na soustředění' + verbose_name_plural = u'Účasti organizátorů na soustředění' + ordering = ['soustredeni', 'organizator'] + + # Interní ID + id = models.AutoField(primary_key = True) + + organizator = models.ForeignKey(Organizator, verbose_name=u'organizátor') + + soustredeni = models.ForeignKey(Soustredeni, verbose_name=u'soustředění') + + poznamka = models.TextField(u'neveřejná poznámka', blank=True, + help_text=u'Neveřejná poznámka k účasti organizátora (plain text)') + + def __str__(self): + return force_unicode(u'%s na %s' % (self.organizator, self.soustredeni, )) + # NOTE: Poteciální DB HOG bez select_related + @python_2_unicode_compatible class VysledkyBase(SeminarModelBase): @@ -778,41 +847,3 @@ class Novinky(models.Model): verbose_name_plural = 'Novinky' -@reversion.register(ignore_duplicate_revisions=True) -@python_2_unicode_compatible -class Organizator(models.Model): - user = models.OneToOneField(settings.AUTH_USER_MODEL, verbose_name='Osoba', - help_text = 'Vyber účet spřažený s organizátorem.') - prezdivka = models.CharField('Přezdívka', max_length = 32, - null = True, blank = True) - organizuje_od_roku = models.IntegerField('Organizuje od roku', - null = True, blank = True) - organizuje_do_roku = models.IntegerField('Organizuje do roku', - null = True, blank = True) - studuje = models.CharField('Studium aj.', max_length = 256, - null = True, blank = True, - help_text="Např. 'Studuje Obecnou fyziku (Bc.), 3. ročník', " - "'Vystudovala Diskrétní modely a algoritmy (Mgr.)' nebo " - "'Přednáší na MFF'") - strucny_popis_organizatora = models.TextField('Stručný popis organizátora', - null = True, blank = True) - foto = ProcessedImageField(verbose_name='Fotografie organizátora', - upload_to='image_organizatori/velke/%Y/', null = True, blank = True, - help_text = 'Vlož fotografii organizátora o libovolné velikosti', - processors=[ - Transpose(Transpose.AUTO), - ResizeToFit(500, 500, upscale=False) - ], - options={'quality': 95}) - foto_male = ImageSpecField(source='foto', - processors=[ - ResizeToFit(200, 200, upscale=False) - ], - options={'quality': 95}) - - def __str__(self): - return str(self.user) - - class Meta: - verbose_name = 'Organizátor' - verbose_name_plural = 'Organizátoři' From be29975d06f6f4b78f4abbf28daa7489e1ac114f Mon Sep 17 00:00:00 2001 From: "Bc. Petr Pecha" Date: Tue, 22 Dec 2015 15:38:24 +0100 Subject: [PATCH 20/26] Organizatori zobrazeni u soustredeni Organizatori se zobrazuji u soustredeni a ucastnici se zobrazuji prehledneji a zbytecne nenatahuji stranku --- seminar/models.py | 7 ++++++- .../soustredeni/seznam_soustredeni.html | 19 +++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/seminar/models.py b/seminar/models.py index 6674239f..d54a5868 100644 --- a/seminar/models.py +++ b/seminar/models.py @@ -612,7 +612,12 @@ class Organizator(models.Model): options={'quality': 95}) def __str__(self): - return str(self.user) + if self.prezdivka: + return u"%s '%s' %s" % (self.user.first_name, + self.prezdivka, + self.user.last_name) + else: + return u"%s %s" % (self.user.first_name, self.user.last_name) class Meta: verbose_name = 'Organizátor' diff --git a/seminar/templates/seminar/soustredeni/seznam_soustredeni.html b/seminar/templates/seminar/soustredeni/seznam_soustredeni.html index f7bc73a8..4c863fc4 100644 --- a/seminar/templates/seminar/soustredeni/seznam_soustredeni.html +++ b/seminar/templates/seminar/soustredeni/seznam_soustredeni.html @@ -60,16 +60,27 @@ {% autoescape off %}{{soustredeni.text}}{% endautoescape %} {% endif %} {% if user.is_authenticated %} +
{# Účastníci #}

Soustředění se zúčastnili tito účastníci:

-
    +

    {% for i in soustredeni.soustredeni_ucastnici_set.all %} -

  • {{i.resitel}} + {{i.resitel}}{% if forloop.last %}.{% else %},{% endif %} {% empty %} -
  • Nic! + Nic! {% endfor %} -
+

+

Soustředění se účastnili tito organizátoři:

+

+ {% for i in soustredeni.soustredeni_organizatori_set.all %} + {{i.organizator}}{% if forloop.last %}.{% else %},{% endif %} + {% empty %} + Nic! + {% endfor %} +

{% endif %} +
+ {% if not soustredeni.verejne_db and user.is_staff %}
{# class="mam-org-only" #} {% endif %} From 8151d421aa61950108b5297918f0e5bd62f843dc Mon Sep 17 00:00:00 2001 From: "Bc. Petr Pecha" Date: Fri, 25 Dec 2015 12:38:42 +0100 Subject: [PATCH 21/26] opraf | zapomenuta migrace --- .../migrations/0007_auto_20151225_1237.py | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 korektury/migrations/0007_auto_20151225_1237.py diff --git a/korektury/migrations/0007_auto_20151225_1237.py b/korektury/migrations/0007_auto_20151225_1237.py new file mode 100644 index 00000000..805e3510 --- /dev/null +++ b/korektury/migrations/0007_auto_20151225_1237.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import korektury.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('korektury', '0006_oprava_pdf'), + ] + + operations = [ + migrations.AddField( + model_name='korekturovanepdf', + name='status', + field=models.CharField(default=b'pridavani', max_length=16, verbose_name='stav PDF', choices=[(b'pridavani', 'P\u0159id\xe1v\xe1n\xed korektur'), (b'zanaseni', 'Korektury jsou zan\xe1\u0161eny'), (b'zastarale', 'Star\xe1 verze, nekorigovat')]), + preserve_default=True, + ), + migrations.AlterField( + model_name='korekturovanepdf', + name='pdf', + field=models.FileField(upload_to=korektury.models.generate_filename, verbose_name='PDF'), + preserve_default=True, + ), + migrations.AlterField( + model_name='oprava', + name='status', + field=models.CharField(default=b'k_oprave', max_length=16, verbose_name='stav opravy', choices=[(b'k_oprave', 'K oprav\u011b'), (b'opraveno', 'Opraveno'), (b'neni_chyba', 'Nen\xed chyba'), (b'k_reakci', 'K reakci autora textu'), (b'smazano', 'Smaz\xe1no')]), + preserve_default=True, + ), + ] From 8d34d78b81a465f2501039ab4749c47692c602f7 Mon Sep 17 00:00:00 2001 From: "Bc. Petr Pecha" Date: Fri, 25 Dec 2015 16:00:19 +0100 Subject: [PATCH 22/26] oprava "/" v korektury/urls.py --- korektury/urls.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/korektury/urls.py b/korektury/urls.py index c2218035..28533b5c 100644 --- a/korektury/urls.py +++ b/korektury/urls.py @@ -4,6 +4,6 @@ from django.contrib.auth.decorators import permission_required from . import views urlpatterns = patterns('', - url(r'^korektury$',permission_required('is_staff')(views.KorekturyListView.as_view()),name='korektury-list'), + url(r'^korektury/$',permission_required('is_staff')(views.KorekturyListView.as_view()),name='korektury-list'), url(r'^korektury/(?P\d+)$', permission_required('is_staff')(views.KorekturyView.as_view()), name='korektury'), ) From 9e66cfa9c479872987bc6f3bd2c538ec5de499d2 Mon Sep 17 00:00:00 2001 From: "Bc. Petr Pecha" Date: Fri, 25 Dec 2015 16:56:41 +0100 Subject: [PATCH 23/26] opraf | do templatu --- korektury/templates/korektury/base.html | 9 +++++++ .../{static => templates}/korektury/help.html | 27 ++++++++++--------- korektury/templates/korektury/opraf.html | 4 +-- korektury/templates/korektury/seznam.html | 4 ++- korektury/urls.py | 3 ++- korektury/views.py | 2 ++ 6 files changed, 32 insertions(+), 17 deletions(-) create mode 100644 korektury/templates/korektury/base.html rename korektury/{static => templates}/korektury/help.html (62%) diff --git a/korektury/templates/korektury/base.html b/korektury/templates/korektury/base.html new file mode 100644 index 00000000..b31d5d47 --- /dev/null +++ b/korektury/templates/korektury/base.html @@ -0,0 +1,9 @@ +{% extends "base.html" %} + +{% block content %} +{# blok do kterého se nacita text, v pripade jinyhc templatu obalit vlastnim blokem #} +{% endblock %} + +{% block title %} +{# blok pro titulek stranky #} +{% endblock %} diff --git a/korektury/static/korektury/help.html b/korektury/templates/korektury/help.html similarity index 62% rename from korektury/static/korektury/help.html rename to korektury/templates/korektury/help.html index e10365f3..0024848e 100644 --- a/korektury/static/korektury/help.html +++ b/korektury/templates/korektury/help.html @@ -1,9 +1,9 @@ - - - - Nápověda ke korigovátku - - +{% extends "korektury/base.html" %} +{% load staticfiles %} + +{% block title %} Nápověda ke korigovátku {% endblock title %} + +{% block content %}

Nápověda ke korigovátku

Korigovátko slouží ke korigování PDF souborů. Umožňuje přidávat a komentovat korektury a označovat je jako zanesené / irelevantní. Rovněž umožňuje o PDF @@ -15,18 +15,18 @@ Kliknu do PDF tam, kam chci zadat korekturu, napíši text a kliknu na Oprav! Korektura se zobrazí na pravé straně červeně. Korektura nelze smazat ani upravit.

-Pokud chci korekturu okomentovat, kliknu na ikonu , +Pokud chci korekturu okomentovat, kliknu na ikonu , napíši komentář a kliknu na Oprav! (nebo Ctrl-Enter). Komentář se zobrazí pod původní korekturou.

Tlačítka u korektury

    -
  • - smazat korekturu -
  • - označt koreturu jako zanesenou -
  • - označit korekturu jako irelevantní +
  • - smazat korekturu +
  • - označt koreturu jako zanesenou +
  • - označit korekturu jako irelevantní (není to chyba, nebude zaneseno) -
  • - upravit text korektury -
  • - okomentovat korekturu +
  • - upravit text korektury +
  • - okomentovat korekturu

Stavy

Korektura

@@ -43,4 +43,5 @@ původní korekturou.
  • Zanášení - probíhá zanášení korektur do TeXu
  • Zastaralé - PDF je zastaralé, nepřidávat nové korektury - + +{% endblock content %} diff --git a/korektury/templates/korektury/opraf.html b/korektury/templates/korektury/opraf.html index bb354a7e..b8fa55c6 100644 --- a/korektury/templates/korektury/opraf.html +++ b/korektury/templates/korektury/opraf.html @@ -12,8 +12,8 @@ {{pdf.komentar}}
    Klikni na chybu, napiš komentář | - ls | - help |          | + seznam souborů | + nápověda |          | hlavní stránka | wiki |
    diff --git a/korektury/templates/korektury/seznam.html b/korektury/templates/korektury/seznam.html index a74ae664..3e1f01e8 100644 --- a/korektury/templates/korektury/seznam.html +++ b/korektury/templates/korektury/seznam.html @@ -1,10 +1,12 @@ -{% extends "base.html" %} +{% extends "korektury/base.html" %} {% block content %}

    {% block nadpis1a %} +{% block title %} Korektury +{% endblock title %} {% endblock nadpis1a %}

    diff --git a/korektury/urls.py b/korektury/urls.py index 28533b5c..8bfd9768 100644 --- a/korektury/urls.py +++ b/korektury/urls.py @@ -5,5 +5,6 @@ from . import views urlpatterns = patterns('', url(r'^korektury/$',permission_required('is_staff')(views.KorekturyListView.as_view()),name='korektury-list'), - url(r'^korektury/(?P\d+)$', permission_required('is_staff')(views.KorekturyView.as_view()), name='korektury'), + url(r'^korektury/(?P\d+)/$', permission_required('is_staff')(views.KorekturyView.as_view()), name='korektury'), + url(r'^korektury/help/', permission_required('is_staff')(views.KorekturyHelpView.as_view()), name='korektury-help'), ) diff --git a/korektury/views.py b/korektury/views.py index 48b57820..6b77f61e 100644 --- a/korektury/views.py +++ b/korektury/views.py @@ -21,6 +21,8 @@ import os from django.conf import settings import unicodedata +class KorekturyHelpView(generic.TemplateView): + template_name = 'korektury/help.html' class KorekturyListView(generic.ListView): model = KorekturovanePDF From 4aa8b03775b6eb9cbbc1e3627f8ef518fa8eae88 Mon Sep 17 00:00:00 2001 From: "Bc. Petr Pecha" Date: Fri, 25 Dec 2015 17:15:40 +0100 Subject: [PATCH 24/26] korektury | opraf relativni odkazy a static --- korektury/templates/korektury/opraf.html | 30 +++++++++++++----------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/korektury/templates/korektury/opraf.html b/korektury/templates/korektury/opraf.html index b8fa55c6..31c7fd21 100644 --- a/korektury/templates/korektury/opraf.html +++ b/korektury/templates/korektury/opraf.html @@ -1,8 +1,10 @@ +{% load staticfiles %} + - - + + Korektury {{pdf.nazev}} @@ -12,9 +14,9 @@ {{pdf.komentar}}
    Klikni na chybu, napiš komentář | - seznam souborů | + seznam souborů | nápověda |          | - hlavní stránka | + hlavní stránka | wiki |
    @@ -105,24 +107,24 @@ {% if o.komentare %} {% else %} {% endif %} {% if o.status = 'opraveno' or o.status = 'neni_chyba' %} {% else %} {% endif %} @@ -130,15 +132,15 @@ {% if o.komentare %} {% else %} {% endif %}
  • @@ -158,12 +160,12 @@
    From 86f909d53db1158c201fbc1b473460a808d24494 Mon Sep 17 00:00:00 2001 From: "Bc. Petr Pecha" Date: Fri, 25 Dec 2015 17:44:27 +0100 Subject: [PATCH 25/26] korektury | oprava static --- korektury/templates/korektury/opraf.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/korektury/templates/korektury/opraf.html b/korektury/templates/korektury/opraf.html index 31c7fd21..f840e203 100644 --- a/korektury/templates/korektury/opraf.html +++ b/korektury/templates/korektury/opraf.html @@ -4,7 +4,7 @@ - + Korektury {{pdf.nazev}} From b2c3f96f8de2d826c462db0e9da022b315ed33c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Mon, 28 Dec 2015 11:03:28 +0100 Subject: [PATCH 26/26] =?UTF-8?q?Korektury:=20fix:=20dovol=20p=C5=99=C3=AD?= =?UTF-8?q?stup=20org=C5=AFm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/urls.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/korektury/urls.py b/korektury/urls.py index 8bfd9768..ab6024a4 100644 --- a/korektury/urls.py +++ b/korektury/urls.py @@ -1,10 +1,12 @@ from django.conf.urls import * # NOQA from django.conf.urls import patterns, url -from django.contrib.auth.decorators import permission_required +from django.contrib.auth.decorators import user_passes_test from . import views +staff_member_required = user_passes_test(lambda u: u.is_staff) + urlpatterns = patterns('', - url(r'^korektury/$',permission_required('is_staff')(views.KorekturyListView.as_view()),name='korektury-list'), - url(r'^korektury/(?P\d+)/$', permission_required('is_staff')(views.KorekturyView.as_view()), name='korektury'), - url(r'^korektury/help/', permission_required('is_staff')(views.KorekturyHelpView.as_view()), name='korektury-help'), + url(r'^korektury/$', staff_member_required(views.KorekturyListView.as_view()), name='korektury-list'), + url(r'^korektury/(?P\d+)/$', staff_member_required(views.KorekturyView.as_view()), name='korektury'), + url(r'^korektury/help/', staff_member_required(views.KorekturyHelpView.as_view()), name='korektury-help'), )