Tomas 'Jethro' Pokorny
9 years ago
24 changed files with 504 additions and 251 deletions
@ -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 = ''' |
|||
<span class="block" data-value="{}"> |
|||
<span class="block"> |
|||
{} |
|||
<span class="block">{}</span> |
|||
</span> |
|||
</span> |
|||
''' |
|||
|
|||
def choice_label(self, obrazek): |
|||
cesta = "/".join(g.nazev for g in cesta_od_korene(obrazek.galerie)) |
|||
popis = "{}<br>".format(obrazek.popis) if obrazek.popis else "" |
|||
return '{}<br>{}{}'.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) |
@ -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', |
|||
), |
|||
] |
@ -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, |
|||
), |
|||
] |
@ -1,33 +1,9 @@ |
|||
\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 |
|||
\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 |
|||
\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 }} \\ |
|||
{% 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} |
|||
|
Loading…
Reference in new issue