From 009cd49f3723047146211c962cf38ae671433b8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 24 Oct 2022 20:16:41 +0200 Subject: [PATCH 01/32] =?UTF-8?q?Revert=20"Fix=20(tab.=20do=C5=A1.=20?= =?UTF-8?q?=C5=99e=C5=A1en=C3=AD):=20strftime=20nefunguje,=20jak=20jsem=20?= =?UTF-8?q?si=20myslel"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 4b03a2d23ce085f72ff486a90f1c283324c647a5. --- odevzdavatko/forms.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/odevzdavatko/forms.py b/odevzdavatko/forms.py index 0e3582c4..271c448a 100644 --- a/odevzdavatko/forms.py +++ b/odevzdavatko/forms.py @@ -155,10 +155,8 @@ class OdevzdavatkoTabulkaFiltrForm(forms.Form): result = [] - date_str = strftime(DATE_FORMAT, datetime.date.min.timetuple()) - if date_str[0] == '1': # Někde očividně vrací strftime rok bez nul. - date_str = "000" + date_str - result.append((date_str, f"Odjakživa")) + result.append(( + strftime(DATE_FORMAT, datetime.date.min.timetuple()), f"Odjakživa")) for deadline in m.Deadline.objects.filter( deadline__lte=timezone.now(), From a03c9a3369947a68ea99dc7ad4d88f76f31d0530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 24 Oct 2022 20:33:55 +0200 Subject: [PATCH 02/32] =?UTF-8?q?Fix=20(tab.=20do=C5=A1.=20=C5=99e=C5=A1en?= =?UTF-8?q?=C3=AD):=20strftime=20vyhazuje=20datum=20bez=20paddingu=20nul,?= =?UTF-8?q?=20tak=20tam=20nak=C3=B3d=C3=ADme=20string=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- odevzdavatko/forms.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/odevzdavatko/forms.py b/odevzdavatko/forms.py index 271c448a..6eb2a973 100644 --- a/odevzdavatko/forms.py +++ b/odevzdavatko/forms.py @@ -155,8 +155,7 @@ class OdevzdavatkoTabulkaFiltrForm(forms.Form): result = [] - result.append(( - strftime(DATE_FORMAT, datetime.date.min.timetuple()), f"Odjakživa")) + result.append(("0001-01-01", f"Odjakživa")) for deadline in m.Deadline.objects.filter( deadline__lte=timezone.now(), From 046a6be790d716df80dfe2ec6b52dad99d9b632c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 31 Oct 2022 21:31:09 +0100 Subject: [PATCH 03/32] =?UTF-8?q?Add:=20Aktu=C3=A1ln=C3=AD=20v=C3=BDsledko?= =?UTF-8?q?vka=20mus=C3=AD=20obsahovat=20datum,=20jinak=20se=20=C5=99e?= =?UTF-8?q?=C5=A1itel=C3=A9=20ptaj=C3=AD.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/templates/seminar/zadani/AktualniVysledkovka.html | 1 + 1 file changed, 1 insertion(+) diff --git a/seminar/templates/seminar/zadani/AktualniVysledkovka.html b/seminar/templates/seminar/zadani/AktualniVysledkovka.html index 20e81ac7..ba97522b 100644 --- a/seminar/templates/seminar/zadani/AktualniVysledkovka.html +++ b/seminar/templates/seminar/zadani/AktualniVysledkovka.html @@ -5,6 +5,7 @@

{% block nadpis1a %} Průběžné výsledky {{ rocnik.rocnik }}. ročníku + {% if vysledkovka.do_deadlinu %}k datu {{ vysledkovka.do_deadlinu.deadline.date }}{% endif %} {% endblock %}

From 51710892dfd3639c49fae47b041380971320bb90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 31 Oct 2022 21:46:24 +0100 Subject: [PATCH 04/32] =?UTF-8?q?Fix:=20ve=C5=99ejn=C3=A1=20v=C3=BDsledkov?= =?UTF-8?q?ka=20ro=C4=8Dn=C3=ADku=20se=20m=C3=A1=20s=C4=8D=C3=ADtat=20jen?= =?UTF-8?q?=20do=20ve=C5=99ejn=C3=A9ho=20deadlinu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vysledkovky/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vysledkovky/utils.py b/vysledkovky/utils.py index 8281e723..f363abfd 100644 --- a/vysledkovky/utils.py +++ b/vysledkovky/utils.py @@ -146,7 +146,10 @@ class VysledkovkaRocniku(Vysledkovka): def __init__(self, rocnik: m.Rocnik, jen_verejne: bool = True): self.rocnik = rocnik self.jen_verejne = jen_verejne - self.do_deadlinu = m.Deadline.objects.filter(cislo__rocnik=rocnik).last() + deadliny = m.Deadline.objects.filter(cislo__rocnik=rocnik) + if jen_verejne: + deadliny = deadliny.filter(verejna_vysledkovka=True) + self.do_deadlinu = deadliny.order_by("deadline").last() @cached_property def aktivni_resitele(self) -> list[m.Resitel]: From 313ee120aee0f0c09b2b15a84dc0e3a43a5ced29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 31 Oct 2022 21:51:22 +0100 Subject: [PATCH 05/32] =?UTF-8?q?Fix:=20aktu=C3=A1ln=C3=AD=20v=C3=BDsledko?= =?UTF-8?q?vka=20u=C5=BE=20nen=C3=AD=20pr=C5=AFb=C4=9B=C5=BEn=C3=A1,=20ale?= =?UTF-8?q?=20k=20datu=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/templates/seminar/zadani/AktualniVysledkovka.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seminar/templates/seminar/zadani/AktualniVysledkovka.html b/seminar/templates/seminar/zadani/AktualniVysledkovka.html index ba97522b..640600f3 100644 --- a/seminar/templates/seminar/zadani/AktualniVysledkovka.html +++ b/seminar/templates/seminar/zadani/AktualniVysledkovka.html @@ -4,7 +4,7 @@

{% block nadpis1a %} - Průběžné výsledky {{ rocnik.rocnik }}. ročníku + Výsledky {{ rocnik.rocnik }}. ročníku {% if vysledkovka.do_deadlinu %}k datu {{ vysledkovka.do_deadlinu.deadline.date }}{% endif %} {% endblock %}

From 81ef3a8f53798d06c89f1c876fd543fe74fe9892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 31 Oct 2022 22:42:42 +0100 Subject: [PATCH 06/32] =?UTF-8?q?Fix:=20resetov=C3=A1n=C3=AD=20hesla=20pos?= =?UTF-8?q?=C3=ADl=C3=A1=20i=20u=C5=BEivatelsk=C3=A9=20jm=C3=A9no,=20ale?= =?UTF-8?q?=20odkaz=20na=20resetov=C3=A1n=C3=AD=20o=20tom=20nemluv=C3=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- various/autentizace/templates/autentizace/login.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/various/autentizace/templates/autentizace/login.html b/various/autentizace/templates/autentizace/login.html index 595c120d..2dbabcc4 100644 --- a/various/autentizace/templates/autentizace/login.html +++ b/various/autentizace/templates/autentizace/login.html @@ -24,7 +24,7 @@

- Zapomněl jsem heslo + Zapomněl jsem heslo nebo uživatelské jméno


From 6eaa174d877993356cc92df5fb2669db485e5d93 Mon Sep 17 00:00:00 2001 From: Karel Balej Date: Mon, 10 Oct 2022 23:48:45 +0200 Subject: [PATCH 07/32] localhost do ALLOWED_HOSTS --- mamweb/settings_local.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mamweb/settings_local.py b/mamweb/settings_local.py index 9368524b..4cf76dc2 100644 --- a/mamweb/settings_local.py +++ b/mamweb/settings_local.py @@ -31,6 +31,7 @@ TEMPLATES[0]['OPTIONS']['debug'] = True from ipaddress import ip_network ALLOWED_HOSTS = [str(ip) for ip in ip_network('192.168.0.0/16')] ALLOWED_HOSTS.append('127.0.0.1') +ALLOWED_HOSTS.append('localhost') # Database # https://docs.djangoproject.com/en/1.7/ref/settings/#databases From 3d1b2794e9de1af26e9105347c8a61b9c3ac56e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 7 Nov 2022 19:44:49 +0100 Subject: [PATCH 08/32] =?UTF-8?q?Fix:=20rozbit=C3=A1=20testdata?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/testutils.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/seminar/testutils.py b/seminar/testutils.py index fe73875f..14932916 100644 --- a/seminar/testutils.py +++ b/seminar/testutils.py @@ -13,7 +13,7 @@ import unidecode import logging from korektury.testutils import create_test_pdf -from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni, PrilohaReseni, Nastaveni, Soustredeni, Soustredeni_Ucastnici, Soustredeni_Organizatori, Osoba, Organizator, Prijemce, Tema, Uloha, Konfera, TextNode, UlohaVzorakNode, RocnikNode, CisloNode, TemaVCisleNode, Text, Hodnoceni, UlohaZadaniNode, Novinky, TreeNode +from seminar.models import Skola, Resitel, Rocnik, Cislo, Deadline, Problem, Reseni, PrilohaReseni, Nastaveni, Soustredeni, Soustredeni_Ucastnici, Soustredeni_Organizatori, Osoba, Organizator, Prijemce, Tema, Uloha, Konfera, TextNode, UlohaVzorakNode, RocnikNode, CisloNode, TemaVCisleNode, Text, Hodnoceni, UlohaZadaniNode, Novinky, TreeNode import seminar.models as m from django.contrib.flatpages.models import FlatPage @@ -299,7 +299,7 @@ def gen_reseni_ulohy(rnd, cisla, uloha, pocet_resitelu, poradi_cisla, resitele_c # Vytvoření řešení. if uloha.cislo_zadani.zlomovy_deadline_pro_papirove_cislo() is not None: # combine, abychom dostali plný čas a ne jen datum - cas_doruceni = datetime.datetime.combine(uloha.cislo_zadani.datum_deadline, datetime.datetime.min.time()) - datetime.timedelta(days=random.randint(0, 40)) - datetime.timedelta(minutes=random.randint(0, 60*24)) + cas_doruceni = uloha.cislo_zadani.deadline_v_cisle.first().deadline - datetime.timedelta(days=random.randint(0, 40)) - datetime.timedelta(minutes=random.randint(0, 60*24)) # astimezone, protože jinak vyhazuje warning o nenastavené TZ res = Reseni.objects.create(forma=rnd.choice(Reseni.FORMA_CHOICES)[0], cas_doruceni=cas_doruceni.astimezone(datetime.timezone.utc)) else: @@ -444,7 +444,6 @@ def gen_cisla(rnd, rocniky): rocnik = rocnik, poradi = str(ci), datum_vydani=vydano, - datum_deadline=deadline, verejne_db=True, verejna_vysledkovka=True ) @@ -452,6 +451,12 @@ def gen_cisla(rnd, rocniky): node2.succ = node node2.root = rocnik.rocniknode cislo.save() + deadline = Deadline.objects.create( + cislo=cislo, + deadline=deadline, + typ=Deadline.TYP_CISLA + ) + deadline.save() node = node2 if otec: otec = False From 100e16030a70b4e4cec0acdb0de9eadc5554b355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 7 Nov 2022 20:42:12 +0100 Subject: [PATCH 09/32] =?UTF-8?q?Fix:=20rozbit=C3=A1=20testdata?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/testutils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seminar/testutils.py b/seminar/testutils.py index 14932916..2d4f3abf 100644 --- a/seminar/testutils.py +++ b/seminar/testutils.py @@ -445,7 +445,6 @@ def gen_cisla(rnd, rocniky): poradi = str(ci), datum_vydani=vydano, verejne_db=True, - verejna_vysledkovka=True ) node2 = CisloNode.objects.get(cislo = cislo) node2.succ = node @@ -454,7 +453,8 @@ def gen_cisla(rnd, rocniky): deadline = Deadline.objects.create( cislo=cislo, deadline=deadline, - typ=Deadline.TYP_CISLA + typ=Deadline.TYP_CISLA, + verejna_vysledkovka=True, ) deadline.save() node = node2 From f12c4ccb7a1d4e229344d9b86ccaf5e325893091 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 7 Nov 2022 20:45:39 +0100 Subject: [PATCH 10/32] =?UTF-8?q?Fix:=20rozbit=C3=A1=20testdata?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/testutils.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/seminar/testutils.py b/seminar/testutils.py index 2d4f3abf..a13e82c8 100644 --- a/seminar/testutils.py +++ b/seminar/testutils.py @@ -436,10 +436,6 @@ def gen_cisla(rnd, rocniky): (mesic_vydani + 1) % 12 + 1, rnd.randint(1, 28)) - # posledni 2 cisla v rocniku nemaji deadline - if (ci + 2 > cisel): - deadline = None - cislo = Cislo.objects.create( rocnik = rocnik, poradi = str(ci), From 32768aab10799f11645124f34404de37efe99903 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 7 Nov 2022 22:05:44 +0100 Subject: [PATCH 11/32] =?UTF-8?q?Fix:=20na=20mobilu=20nen=C3=AD=20menu=20k?= =?UTF-8?q?orektur?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mamweb/templates/menu_mobile.html | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mamweb/templates/menu_mobile.html b/mamweb/templates/menu_mobile.html index aed04cd5..28b3aad3 100644 --- a/mamweb/templates/menu_mobile.html +++ b/mamweb/templates/menu_mobile.html @@ -3,11 +3,9 @@ {% autoescape off %} {% endif %} diff --git a/seminar/templates/seminar/archiv/cislo_obalkovani.html b/seminar/templates/seminar/archiv/cislo_obalkovani.html deleted file mode 100644 index 48b4a324..00000000 --- a/seminar/templates/seminar/archiv/cislo_obalkovani.html +++ /dev/null @@ -1,33 +0,0 @@ -{% extends "base.html" %} - -{% block content %} -

- {% block nadpis1a %} - Obálkování {{ cislo }} - {% endblock %} -

- - Obálkovat se budou tyto problémy: -
    - {% for p in problemy %} - -
  • {{ p.kod_v_rocniku }} {{ p }} - {% endfor %} -
- - {% for r in reseni %} - {% ifchanged r.resitel %} - {% if not forloop.first %} - - {% endif %} -

{{ r.resitel }}

-
    - {% endifchanged %} - -
  • - {{ r.problem.kod_v_rocniku }} {{ r.problem.nazev }} ({{ r.body }}) - - {% endfor %} -
- -{% endblock content %} diff --git a/seminar/templates/seminar/org/obalkovani.html b/seminar/templates/seminar/org/obalkovani.html deleted file mode 100644 index a4420dba..00000000 --- a/seminar/templates/seminar/org/obalkovani.html +++ /dev/null @@ -1,30 +0,0 @@ -{% extends "base.html" %} - -{% block content %} -

- {% block nadpis1a %} - Obálkování {{ cislo }} - {% endblock %} -

-
    - {% for reseni in object_list %} - {% ifchanged reseni.resitele %} - {% if not forloop.first %} -
- {% endif %} -

{% for resitel in reseni.resitele.all %}{{resitel.osoba}},{% endfor %}

-
    - {% endifchanged %} - -
  • Celkem {{reseni.hodnoceni__body__sum}} bodů z {{reseni.hodnoceni__count}} hodnocení -
      - {% for h in reseni.hodnoceni_set.all %} -
    • {{ h.problem }}: {{ h.body }}b
    • - {% endfor %} -
    -
  • - {% endfor %} -
- - -{% endblock content %} diff --git a/seminar/urls.py b/seminar/urls.py index c6ab5695..f6f2e2fb 100644 --- a/seminar/urls.py +++ b/seminar/urls.py @@ -23,7 +23,6 @@ Soubor sloužící jako „router“, tj. zde se definují url adresy a na co uk - ``cislo/./obalky.pdf`` (seminar_cislo_obalky) :func:`~seminar.views.views_all.cisloObalkyView` - ``cislo/./tituly.tex`` (seminar_cislo_titul) :func:`~seminar.views.views_all.TitulyView` - ``stav`` (stav_databaze) :func:`~seminar.views.views_all.StavDatabazeView` - - ``cislo/./obalkovani`` (seminar_cislo_resitel_obalkovani) :class:`~seminar.views.views_all.ObalkovaniView` - ``cislo/./odmeny/./`` (seminar_archiv_odmeny) :class:`~seminar.views.views_all.OdmenyView` - Další - `` `` (titulni_strana) :class:`~seminar.views.views_all.TitulniStranaView` @@ -102,11 +101,6 @@ urlpatterns = [ org_required(views.StavDatabazeView), name='stav_databaze' ), - path( - 'cislo/./obalkovani', - org_required(views.ObalkovaniView.as_view()), - name='seminar_cislo_resitel_obalkovani' - ), path( 'cislo/./odmeny/./', org_required(views.OdmenyView.as_view()), diff --git a/seminar/views/views_all.py b/seminar/views/views_all.py index 7cf79d9f..2c4bd4a6 100644 --- a/seminar/views/views_all.py +++ b/seminar/views/views_all.py @@ -53,23 +53,6 @@ logger = logging.getLogger(__name__) def get_problemy_k_tematu(tema): return Problem.objects.filter(nadproblem = tema) -class ObalkovaniView(generic.ListView): - template_name = 'seminar/org/obalkovani.html' - - def get_queryset(self): - rocnik = get_object_or_404(Rocnik,rocnik=self.kwargs['rocnik']) - cislo = get_object_or_404(Cislo,rocnik=rocnik,poradi=self.kwargs['cislo']) - self.cislo = cislo - self.hodnoceni = s.Hodnoceni.objects.filter(cislo_body=cislo) - self.reseni = Reseni.objects.filter(hodnoceni__in = self.hodnoceni).annotate(Sum('hodnoceni__body')).annotate(Count('hodnoceni')).order_by('resitele__osoba') - return self.reseni - - def get_context_data(self, **kwargs): - context = super(ObalkovaniView, self).get_context_data(**kwargs) - print(self.cislo) - context['cislo'] = self.cislo - return context - # FIXME: Pozor, níž je ještě jeden ProblemView! #class ProblemView(generic.DetailView): @@ -597,28 +580,6 @@ def obalkyView(request, resitele): return response -def oldObalkovaniView(request, rocnik, cislo): - rocnik = Rocnik.objects.get(rocnik=rocnik) - cislo = Cislo.objects.get(rocnik=rocnik, cislo=cislo) - - reseni = ( - Reseni.objects.filter(cislo_body=cislo) - .order_by( - 'resitel__prijmeni', - 'resitel__jmeno', - 'problem__typ', - 'problem__kod' - ) - ) - - problemy = sorted(set(r.problem for r in reseni), key=lambda p: (p.typ, p.kod)) - return render( - request, - 'seminar/archiv/cislo_obalkovani.html', - {'cislo': cislo, 'problemy': problemy, 'reseni': reseni} - ) - - ### Tituly def TitulyViewRocnik(request, rocnik): return TitulyView(request, rocnik, None) From 2c9c1dc8e17c8b93f5bb10fe9da0c5524054da12 Mon Sep 17 00:00:00 2001 From: Kristyna Petrlikova Date: Mon, 14 Nov 2022 23:08:02 +0100 Subject: [PATCH 19/32] =?UTF-8?q?P=C5=99id=C3=A1n=C3=AD=20=C3=BA=C4=8Dastn?= =?UTF-8?q?ick=C3=A9ho=20poplatku=20v=20nastaven=C3=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/migrations/0108_nastaveni_cena_sous.py | 18 ++++++++++++++++++ seminar/models/tvorba.py | 4 ++++ 2 files changed, 22 insertions(+) create mode 100644 seminar/migrations/0108_nastaveni_cena_sous.py diff --git a/seminar/migrations/0108_nastaveni_cena_sous.py b/seminar/migrations/0108_nastaveni_cena_sous.py new file mode 100644 index 00000000..112b2a6c --- /dev/null +++ b/seminar/migrations/0108_nastaveni_cena_sous.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.16 on 2022-11-14 20:51 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0107_zmrazenavysledkovka'), + ] + + operations = [ + migrations.AddField( + model_name='nastaveni', + name='cena_sous', + field=models.IntegerField(default=1000, verbose_name='Účastnický poplatek za soustředění'), + ), + ] diff --git a/seminar/models/tvorba.py b/seminar/models/tvorba.py index 57813f39..7e04b213 100644 --- a/seminar/models/tvorba.py +++ b/seminar/models/tvorba.py @@ -718,6 +718,10 @@ class Nastaveni(SingletonModel): aktualni_cislo = models.ForeignKey(Cislo, verbose_name='Aktuální číslo', null=False, on_delete=models.PROTECT) + cena_sous = models.IntegerField(null=False, + verbose_name="Účastnický poplatek za soustředění", + default=1000) + @property def aktualni_rocnik(self): return self.aktualni_cislo.rocnik From c08e6c87f5c0b5a5f9b2467ee661cfabef2be6a5 Mon Sep 17 00:00:00 2001 From: Kristyna Petrlikova Date: Mon, 14 Nov 2022 23:16:24 +0100 Subject: [PATCH 20/32] =?UTF-8?q?P=C5=99eps=C3=A1n=C3=AD=20stvrzenek=20do?= =?UTF-8?q?=20templates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/static/seminar/stvrzenky.tex | 25 ------------- .../templates/soustredeni/stvrzenky.tex | 37 +++++++++++++++++++ .../templates/soustredeni/ucastnici.tex | 5 --- soustredeni/views.py | 26 ++++++------- 4 files changed, 49 insertions(+), 44 deletions(-) delete mode 100644 seminar/static/seminar/stvrzenky.tex create mode 100644 soustredeni/templates/soustredeni/stvrzenky.tex delete mode 100644 soustredeni/templates/soustredeni/ucastnici.tex diff --git a/seminar/static/seminar/stvrzenky.tex b/seminar/static/seminar/stvrzenky.tex deleted file mode 100644 index 28eab580..00000000 --- a/seminar/static/seminar/stvrzenky.tex +++ /dev/null @@ -1,25 +0,0 @@ -\input opmac -\chyph -\nopagenumbers -\parindent=0pt - -\def\castka{1000} - -\newread\data -\openin\data=/dev/stdin -\read\data to\termin -\read\data to\misto - -\loop - \read\data to\ucastnik - \unless\ifeof\data - \vbox{\picw=2cm\inspic logomm.pdf \smallskip\hrule\medskip - Potvrzujeme, že \ucastnik se zúčastnil(a) soustředění Korespondenčního semináře M\&M konaného % \ucastnik má na konci mezeru - v~termínu \termin a že zaplatil(a) účastnický poplatek ve výši $\sim$\castka Kč$\sim$. % \termin též - \bigskip - \the\day.~\the\month.~\the\year, \misto\hfill Přijal(a): \hbox to 4cm{\hrulefill} - \bigskip - } -\repeat - -\bye diff --git a/soustredeni/templates/soustredeni/stvrzenky.tex b/soustredeni/templates/soustredeni/stvrzenky.tex new file mode 100644 index 00000000..78752866 --- /dev/null +++ b/soustredeni/templates/soustredeni/stvrzenky.tex @@ -0,0 +1,37 @@ +{% autoescape off %} +{% load static %} +{% load tex %} +\documentclass[11pt,a4paper]{article} +\usepackage[left=0.75in, right=0.75in,top=0.5in,bottom=0.5in]{geometry} +\usepackage[T1]{fontenc} +\usepackage[utf8]{inputenc} +\usepackage[czech]{babel} +\usepackage{graphicx} +\begin{document} +\pagenumbering{gobble} +\parindent=0pt + +\def\stvrzenka#1#2{ + \vbox{% + \includegraphics[width=2cm]{logomm.pdf} + \smallskip\hrule\medskip + {% with soustredeni as s %} + Potvrzujeme, že #1 #2 se zúčastnil(a) soustředění Korespondenčního semináře M\&M konaného + v~termínu {{s.datum_zacatku|date:"j.~n.~Y"|sloz}} -- + {{s.datum_konce|date:"j.~n.~Y"|sloz}} a~že zaplatil(a) účastnický poplatek ve + výši $\sim${{castka|sloz}}Kč$\sim$. + + \bigskip + {{s.datum_zacatku|date:"j.~n.~Y"|sloz}}, {{s.misto|sloz}} \hfill Přijal(a): \hbox to 4cm{\hrulefill} + \bigskip + } + {% endwith %} +} + +{% for u in ucastnici %} + {% with o=u.osoba %} + \stvrzenka{{o.jmeno|sloz}}{{o.prijmeni|sloz}} + {% endwith %} +{% endfor %} +\end{document} +{% endautoescape %} diff --git a/soustredeni/templates/soustredeni/ucastnici.tex b/soustredeni/templates/soustredeni/ucastnici.tex deleted file mode 100644 index a39885a6..00000000 --- a/soustredeni/templates/soustredeni/ucastnici.tex +++ /dev/null @@ -1,5 +0,0 @@ -{% load tex %} -\newcommand{\datum}{{datum|date:"j. n. Y"|sloz}} -{% for u in ucastnici %} -\stvrzenka{{u.cislo_stvrzenky|sloz}}{{u.jmeno|sloz}}{{u.prijmeni|sloz}}{{u.ulice|sloz}}{{u.psc|sloz}}{{u.mesto|sloz}} -{% endfor %} diff --git a/soustredeni/views.py b/soustredeni/views.py index 54c34fbe..e5ae2992 100644 --- a/soustredeni/views.py +++ b/soustredeni/views.py @@ -1,8 +1,9 @@ -from django.shortcuts import get_object_or_404 +from django.shortcuts import get_object_or_404, render from django.http import HttpResponse from django.views import generic from django.conf import settings -from seminar.models import Soustredeni, Resitel, Soustredeni_Ucastnici # Tohle je stare a chceme se toho zbavit. Pouzivejte s.ToCoChci +from django.contrib.staticfiles.finders import find +from seminar.models import Soustredeni, Resitel, Soustredeni_Ucastnici, Nastaveni # Tohle je stare a chceme se toho zbavit. Pouzivejte s.ToCoChci import csv import tempfile import shutil @@ -62,20 +63,17 @@ def soustredeniUcastniciExportView(request, soustredeni): def soustredeniStvrzenkyView(request, soustredeni): soustredeni = get_object_or_404(Soustredeni, id=soustredeni) ucastnici = Resitel.objects.filter(soustredeni=soustredeni) + castka = Nastaveni.get_solo().cena_sous + tex = render(request, 'soustredeni/stvrzenky.tex', {'ucastnici': ucastnici, 'soustredeni': soustredeni, 'castka': castka}).content - static = Path(settings.STATIC_ROOT) tempdir = Path(tempfile.mkdtemp()) - shutil.copy(static / 'images/logomm.pdf', tempdir) - shutil.copy(static / 'seminar/stvrzenky.tex', tempdir) - subprocess.run( - ['pdfcsplain', 'stvrzenky.tex'], - cwd=tempdir, - encoding='utf-8', - input=f'{soustredeni.datum_zacatku.strftime("%-d.~%-m.~%Y")} -- {soustredeni.datum_konce.strftime("%-d.~%-m.~%Y")}\n{soustredeni.misto}\n' - + '\n'.join([f'{u.osoba.jmeno} {u.osoba.prijmeni}' for u in ucastnici]) - ) - - with open(tempdir / 'stvrzenky.pdf', 'rb') as pdffile: + with open(tempdir / "stvrzenky.tex", "w") as texfile: + texfile.write(tex.decode()) + + shutil.copy(find('images/logomm.pdf'), tempdir) + subprocess.call(["pdflatex", "stvrzenky.tex"], cwd = tempdir, stdout=subprocess.DEVNULL) + + with open(tempdir / "stvrzenky.pdf", "rb") as pdffile: response = HttpResponse(pdffile.read(), content_type='application/pdf') shutil.rmtree(tempdir) return response From 23dde1263a28db51e0e5a12be382e4cc46f3b93d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 14 Nov 2022 23:32:33 +0100 Subject: [PATCH 21/32] =?UTF-8?q?Fix:=20Petr=20chce=20ob=C3=A1lkovat=20od?= =?UTF-8?q?=20=C4=8D=C3=ADsla=20do=20=C4=8D=C3=ADsla?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/templates/seminar/archiv/odmeny.html | 20 ++++---------------- seminar/views/views_all.py | 17 +++++------------ 2 files changed, 9 insertions(+), 28 deletions(-) diff --git a/seminar/templates/seminar/archiv/odmeny.html b/seminar/templates/seminar/archiv/odmeny.html index aa5ffb7f..6b2d1eb7 100644 --- a/seminar/templates/seminar/archiv/odmeny.html +++ b/seminar/templates/seminar/archiv/odmeny.html @@ -7,23 +7,11 @@ {% endblock %} -

Od prvního deadlinu {{ from_cislo }} do prvního deadlinu {{ to_cislo }}

+

Od čísla {{ from_cislo }} do čísla {{ to_cislo }}

+ (Od „{{ from_deadline }}“ (vyjma) do „{{ to_deadline }}“ (včetně))
+
Posílat použe po opravení všeho v čísle {{ to_cislo }}!
    - {% for z in zmeny_prvni_prvni %} -
  • {{z.jmeno}}: {{z.ftitul}} → {{z.ttitul}}
  • - {% endfor %} -
- -

Od {{ from_cislo }} do prvního deadlinu {{ to_cislo }} (pro první číslo)

-
    - {% for z in zmeny_posledni_prvni %} -
  • {{z.jmeno}}: {{z.ftitul}} → {{z.ttitul}}
  • - {% endfor %} -
- -

Od prvního deadlinu {{ from_cislo }} do {{ to_cislo }} (pro poslední číslo)

-
    - {% for z in zmeny_prvni_posledni %} + {% for z in zmeny %}
  • {{z.jmeno}}: {{z.ftitul}} → {{z.ttitul}}
  • {% endfor %}
diff --git a/seminar/views/views_all.py b/seminar/views/views_all.py index 7cf79d9f..424804b1 100644 --- a/seminar/views/views_all.py +++ b/seminar/views/views_all.py @@ -484,18 +484,11 @@ class OdmenyView(generic.TemplateView): context["from_cislo"] = fromcislo context["to_cislo"] = tocislo - context["zmeny_prvni_prvni"] = get_diff( - fromcislo.zlomovy_deadline_pro_papirove_cislo(), - tocislo.zlomovy_deadline_pro_papirove_cislo() - ) - context["zmeny_prvni_posledni"] = get_diff( - fromcislo.zlomovy_deadline_pro_papirove_cislo(), - posledni_deadline_oprava(tocislo) - ) - context["zmeny_posledni_prvni"] = get_diff( - posledni_deadline_oprava(fromcislo), - tocislo.zlomovy_deadline_pro_papirove_cislo() - ) + from_deadline = posledni_deadline_oprava(fromcislo) + to_deadline = posledni_deadline_oprava(tocislo) + context["from_deadline"] = from_deadline + context["to_deadline"] = to_deadline + context["zmeny"] = get_diff(from_deadline, to_deadline) return context From 8c1f042ea0732980772ce1df998e8f8dd82aa01f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 14 Nov 2022 23:56:54 +0100 Subject: [PATCH 22/32] =?UTF-8?q?Fix:=20Haha,=20Jid=C3=A1=C5=A1=20neum?= =?UTF-8?q?=C3=AD=20mergeovat=20pull=20requesty=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{0108_hodnoceni_feedback.py => 0109_hodnoceni_feedback.py} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename seminar/migrations/{0108_hodnoceni_feedback.py => 0109_hodnoceni_feedback.py} (89%) diff --git a/seminar/migrations/0108_hodnoceni_feedback.py b/seminar/migrations/0109_hodnoceni_feedback.py similarity index 89% rename from seminar/migrations/0108_hodnoceni_feedback.py rename to seminar/migrations/0109_hodnoceni_feedback.py index 282849d8..cf920950 100644 --- a/seminar/migrations/0108_hodnoceni_feedback.py +++ b/seminar/migrations/0109_hodnoceni_feedback.py @@ -6,7 +6,7 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('seminar', '0107_zmrazenavysledkovka'), + ('seminar', '0108_nastaveni_cena_sous'), ] operations = [ From 2a81dbe09d26ba5be654352c03242ed56d304c4f Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Tue, 15 Nov 2022 00:47:19 +0100 Subject: [PATCH 23/32] =?UTF-8?q?P=C5=99id=C3=A1n=20editorconfig?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .editorconfig | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..e99349e1 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +root = true + +[*] +charset = utf-8 +# Unix-y lines +end_of_line = lf +insert_final_newline = true + +[*.py] +indent_style = tab +# I do not think we prescribe, how big a tab is. +indent_size = tab + +# Migrations are auto-generated and thus follow PEP-8, let's not fight with that +[*/migrations/*.py] +indent_style = space +indent_size = 4 From e810d01b0ec8a689111a639e5769b757ce1c9037 Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Tue, 15 Nov 2022 12:49:11 +0100 Subject: [PATCH 24/32] =?UTF-8?q?Unset=20je=20lep=C5=A1=C3=AD=20varianta?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .editorconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index e99349e1..c86d7658 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,7 +9,7 @@ insert_final_newline = true [*.py] indent_style = tab # I do not think we prescribe, how big a tab is. -indent_size = tab +indent_size = unset # Migrations are auto-generated and thus follow PEP-8, let's not fight with that [*/migrations/*.py] From e1be20c08b3f454250b638c137cb74dd45f0f029 Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Wed, 16 Nov 2022 01:18:59 +0100 Subject: [PATCH 25/32] =?UTF-8?q?HTML=20odsazovat=20dv=C4=9Bma=20mezerami?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .editorconfig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.editorconfig b/.editorconfig index c86d7658..639d9791 100644 --- a/.editorconfig +++ b/.editorconfig @@ -15,3 +15,7 @@ indent_size = unset [*/migrations/*.py] indent_style = space indent_size = 4 + +[*.html] +indent_style = space +indent_size = 2 From 914ec732af19a72614a44cbf23ee2c70f7b0d716 Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Wed, 16 Nov 2022 01:37:40 +0100 Subject: [PATCH 26/32] =?UTF-8?q?CSS=20jsou=20pro=20=C3=BA=C4=8Dely=20edit?= =?UTF-8?q?ace=20asi=20v=C3=ADcem=C3=A9n=C4=9B=20python?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .editorconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 639d9791..e385fb3c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -6,7 +6,7 @@ charset = utf-8 end_of_line = lf insert_final_newline = true -[*.py] +[*.{py,css}] indent_style = tab # I do not think we prescribe, how big a tab is. indent_size = unset From 38192db1de2d617bbfeeebff0b7d984a4a214f31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Turinsk=C3=BD?= Date: Wed, 16 Nov 2022 21:17:19 +0100 Subject: [PATCH 27/32] Popis, co je .editorconfig --- .editorconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.editorconfig b/.editorconfig index e385fb3c..94a82858 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,3 +1,6 @@ +# Univerzální popis našich konvencí pro nastavení editorů. +# Vizte https://editorconfig.org pro detaily + root = true [*] From 30853ecd77cb02f450bef1dd26b4e3e9877b5296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Turinsk=C3=BD?= Date: Wed, 16 Nov 2022 21:20:09 +0100 Subject: [PATCH 28/32] =?UTF-8?q?Koment=C3=A1=C5=99e=20=C4=8Desky?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .editorconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.editorconfig b/.editorconfig index 94a82858..758912bb 100644 --- a/.editorconfig +++ b/.editorconfig @@ -5,16 +5,16 @@ root = true [*] charset = utf-8 -# Unix-y lines +# Unixové řádky end_of_line = lf insert_final_newline = true [*.{py,css}] indent_style = tab -# I do not think we prescribe, how big a tab is. +# Nenařizujeme konkrétní šířku tabulátoru indent_size = unset -# Migrations are auto-generated and thus follow PEP-8, let's not fight with that +# Automaticky generované migrace dodržují PEP-8, nemá smysl s tím moc bojovat. [*/migrations/*.py] indent_style = space indent_size = 4 From 6ee9c4e3808a2d4614eee179ed4cb9673ea34318 Mon Sep 17 00:00:00 2001 From: MaM Web user Date: Mon, 21 Nov 2022 20:05:06 +0100 Subject: [PATCH 29/32] Requirements: myst_parser pro dokumentaci --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 9ad24a7f..d4713d76 100644 --- a/requirements.txt +++ b/requirements.txt @@ -62,3 +62,4 @@ lorem sphinx sphinx_rtd_theme +myst_parser From 7b5db01377070e7963a30c654331863b65123ff6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Thu, 24 Nov 2022 20:16:09 +0100 Subject: [PATCH 30/32] =?UTF-8?q?hotfix:=20org=20nem=C5=AF=C5=BEe=20p?= =?UTF-8?q?=C5=99i=C5=99adit=20hodnocen=C3=AD=20nezadan=C3=BD=20probl?= =?UTF-8?q?=C3=A9m=20(nap=C5=99.=20vy=C5=99e=C5=A1en=C3=BD)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/urls.py | 1 + api/views/autocomplete.py | 9 +++++++++ odevzdavatko/forms.py | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/api/urls.py b/api/urls.py index 23aafe36..2570ded9 100644 --- a/api/urls.py +++ b/api/urls.py @@ -23,6 +23,7 @@ urlpatterns = [ path('api/autocomplete/skola/', views.SkolaAutocomplete.as_view(), name='autocomplete_skola'), path('api/autocomplete/resitel/', org_required(views.ResitelAutocomplete.as_view()), name='autocomplete_resitel'), path('api/autocomplete/problem/odevzdatelny', views.OdevzdatelnyProblemAutocomplete.as_view(), name='autocomplete_problem_odevzdatelny'), + path('api/autocomplete/problem/vsechny', views.ProblemAutocomplete.as_view(), name='autocomplete_problem'), # Ceka na autocomplete v3 # path('autocomplete/organizatori/', diff --git a/api/views/autocomplete.py b/api/views/autocomplete.py index 217df008..4cd2552a 100644 --- a/api/views/autocomplete.py +++ b/api/views/autocomplete.py @@ -66,6 +66,15 @@ class OdevzdatelnyProblemAutocomplete(autocomplete.Select2QuerySetView): Q(nazev__icontains=self.q)) return qs +class ProblemAutocomplete(autocomplete.Select2QuerySetView): + """ View k :mod:`dal.autocomplete` pro vyhledávání problémů především v odevzdávátku. """ + def get_queryset(self): + qs = m.Problem.objects.all().order_by("-stav", "nazev") + if self.q: + qs = qs.filter( + Q(nazev__icontains=self.q)) + return qs + # Ceka na autocomplete v3 # class OrganizatorAutocomplete(autocomplete.Select2QuerySetView): # def get_queryset(self): diff --git a/odevzdavatko/forms.py b/odevzdavatko/forms.py index a8538668..65a8b7ac 100644 --- a/odevzdavatko/forms.py +++ b/odevzdavatko/forms.py @@ -91,7 +91,7 @@ class JednoHodnoceniForm(forms.ModelForm): fields = ('problem', 'body', 'deadline_body', 'feedback',) widgets = { 'problem': autocomplete.ModelSelect2( - url='autocomplete_problem_odevzdatelny', # FIXME: Dovolit i starší? + url='autocomplete_problem', ), 'feedback': forms.Textarea(attrs={'rows': 1, 'cols': 30, 'class': 'feedback'}), } From 728de9be067f04454b6408e5bdd00e44d531c818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Thu, 24 Nov 2022 20:41:17 +0100 Subject: [PATCH 31/32] =?UTF-8?q?hotfix:=20p=C5=99i=20vyb=C3=ADr=C3=A1n?= =?UTF-8?q?=C3=AD=20probl=C3=A9mu=20jsou=20vid=C4=9Bt=20i=20star=C3=A9=20r?= =?UTF-8?q?o=C4=8Dn=C3=ADky,=20ale=20sortit=20podle=20ro=C4=8Dn=C3=ADku=20?= =?UTF-8?q?neum=C3=ADm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/views/autocomplete.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/api/views/autocomplete.py b/api/views/autocomplete.py index 4cd2552a..8c6f334c 100644 --- a/api/views/autocomplete.py +++ b/api/views/autocomplete.py @@ -69,7 +69,13 @@ class OdevzdatelnyProblemAutocomplete(autocomplete.Select2QuerySetView): class ProblemAutocomplete(autocomplete.Select2QuerySetView): """ View k :mod:`dal.autocomplete` pro vyhledávání problémů především v odevzdávátku. """ def get_queryset(self): - qs = m.Problem.objects.all().order_by("-stav", "nazev") + # FIXME i starší úlohy + nastaveni = get_object_or_404(m.Nastaveni) + rocnik = nastaveni.aktualni_rocnik + temaQ = Q(Tema___rocnik = rocnik, stav=m.Problem.STAV_ZADANY) + ulohaQ = Q(Uloha___cislo_zadani__rocnik = rocnik, stav=m.Problem.STAV_ZADANY) + clanekQ = Q(Clanek___cislo__rocnik = rocnik, stav=m.Problem.STAV_ZADANY) + qs = m.Problem.objects.filter(temaQ | ulohaQ | clanekQ).order_by("-stav", "nazev") if self.q: qs = qs.filter( Q(nazev__icontains=self.q)) From 79fea4074e18a9521a5af01c0696ebcd16e7f523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Thu, 24 Nov 2022 20:44:15 +0100 Subject: [PATCH 32/32] =?UTF-8?q?hotfix:=20kruci,=20kop=C3=ADrov=C3=A1n?= =?UTF-8?q?=C3=AD=20je=20=C4=8Dast=C3=BDm=20zdrojem=20chyb?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/views/autocomplete.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/views/autocomplete.py b/api/views/autocomplete.py index 8c6f334c..33e083eb 100644 --- a/api/views/autocomplete.py +++ b/api/views/autocomplete.py @@ -72,9 +72,9 @@ class ProblemAutocomplete(autocomplete.Select2QuerySetView): # FIXME i starší úlohy nastaveni = get_object_or_404(m.Nastaveni) rocnik = nastaveni.aktualni_rocnik - temaQ = Q(Tema___rocnik = rocnik, stav=m.Problem.STAV_ZADANY) - ulohaQ = Q(Uloha___cislo_zadani__rocnik = rocnik, stav=m.Problem.STAV_ZADANY) - clanekQ = Q(Clanek___cislo__rocnik = rocnik, stav=m.Problem.STAV_ZADANY) + temaQ = Q(Tema___rocnik = rocnik) + ulohaQ = Q(Uloha___cislo_zadani__rocnik=rocnik) + clanekQ = Q(Clanek___cislo__rocnik=rocnik) qs = m.Problem.objects.filter(temaQ | ulohaQ | clanekQ).order_by("-stav", "nazev") if self.q: qs = qs.filter(