diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..758912bb --- /dev/null +++ b/.editorconfig @@ -0,0 +1,24 @@ +# Univerzální popis našich konvencí pro nastavení editorů. +# Vizte https://editorconfig.org pro detaily + +root = true + +[*] +charset = utf-8 +# Unixové řádky +end_of_line = lf +insert_final_newline = true + +[*.{py,css}] +indent_style = tab +# Nenařizujeme konkrétní šířku tabulátoru +indent_size = unset + +# Automaticky generované migrace dodržují PEP-8, nemá smysl s tím moc bojovat. +[*/migrations/*.py] +indent_style = space +indent_size = 4 + +[*.html] +indent_style = space +indent_size = 2 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..33e083eb 100644 --- a/api/views/autocomplete.py +++ b/api/views/autocomplete.py @@ -66,6 +66,21 @@ 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): + # FIXME i starší úlohy + nastaveni = get_object_or_404(m.Nastaveni) + rocnik = nastaveni.aktualni_rocnik + 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( + Q(nazev__icontains=self.q)) + return qs + # Ceka na autocomplete v3 # class OrganizatorAutocomplete(autocomplete.Select2QuerySetView): # def get_queryset(self): diff --git a/mamweb/settings_common.py b/mamweb/settings_common.py index baebe3b4..5a610795 100644 --- a/mamweb/settings_common.py +++ b/mamweb/settings_common.py @@ -160,6 +160,9 @@ INSTALLED_APPS = ( # 'admin_tools.menu', # 'admin_tools.dashboard', 'django.contrib.admin', + + # Nechat na konci (INSTALLED_APPS je uspořádané): + 'django_cleanup.apps.CleanupConfig', # Uklízí media/ ) DEBUG_TOOLBAR_CONFIG = { 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 diff --git a/mamweb/static/css/mamweb.css b/mamweb/static/css/mamweb.css index fa5de880..53e06967 100644 --- a/mamweb/static/css/mamweb.css +++ b/mamweb/static/css/mamweb.css @@ -421,6 +421,10 @@ input { margin: 5px; } +textarea.feedback { + margin: 5px; +} + /* titulni stranka */ diff --git a/mamweb/templates/admin/base_site.html b/mamweb/templates/admin/base_site.html index b5738832..ce58b32e 100644 --- a/mamweb/templates/admin/base_site.html +++ b/mamweb/templates/admin/base_site.html @@ -10,5 +10,5 @@ {% block bodyclass %}{{ LOCAL_TEST_PROD }}web{% endblock %} {% block branding %} -

M&M GWP web

+

M&M web

{% endblock %} 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 %}