From 4ea24e673a31b6578a501dbdc5b218fd3eb1b499 Mon Sep 17 00:00:00 2001 From: "Tomas \"Jethro\" Pokorny" Date: Mon, 14 Nov 2016 09:06:48 +0100 Subject: [PATCH 1/2] Pridana funkce na aktivni organizatory. Priprava na autocomplete organizatoru, ale potreba prejit na novou verzi django-autocomplete-light. --- seminar/urls.py | 5 +++++ seminar/views.py | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/seminar/urls.py b/seminar/urls.py index f7228b47..1133175c 100644 --- a/seminar/urls.py +++ b/seminar/urls.py @@ -68,4 +68,9 @@ urlpatterns = [ url(r'^tex-upload/login/$', views.LoginView, name='seminar_login'), url(r'^tex-upload/$', staff_member_required(views.texUploadView), name='seminar_tex_upload'), + + # Ceka na autocomplete v3 + #url(r'^autocomplete/organizatori/$', staff_member_required(views.OrganizatorAutocomplete.as_view()), name='seminar_autocomplete_organizator') + + ] diff --git a/seminar/views.py b/seminar/views.py index 141e9492..b9243f0f 100644 --- a/seminar/views.py +++ b/seminar/views.py @@ -123,11 +123,16 @@ class StareNovinkyView(generic.ListView): ### Co je M&M ## Organizatori +def aktivniOrganizatori(rok=date.today().year): + return Organizator.objects.exclude( + organizuje_do_roku__isnull=False, + organizuje_do_roku__lt=rok + ).order_by('user__first_name') class CojemamOrganizatoriView(generic.ListView): model = Organizator template_name='seminar/cojemam/organizatori.html' - queryset = Organizator.objects.exclude(organizuje_do_roku__isnull=False, organizuje_do_roku__lt=date.today().year).order_by('user__first_name') + queryset = aktivniOrganizatori() def get_context_data(self, **kwargs): context = super(CojemamOrganizatoriView, self).get_context_data(**kwargs) context['aktivni'] = True @@ -136,7 +141,7 @@ class CojemamOrganizatoriView(generic.ListView): class CojemamOrganizatoriStariView(generic.ListView): model = Organizator template_name='seminar/cojemam/organizatori.html' - queryset = Organizator.objects.filter(organizuje_do_roku__isnull=False, organizuje_do_roku__lt=date.today().year).order_by('-organizuje_do_roku') + queryset = aktivniOrganizatori().order_by('-organizuje_do_roku') ### Archiv @@ -782,3 +787,26 @@ def texDownloadView(request, rocnik, cislo): ], } return JsonResponse(response) + + + +# Ceka na autocomplete v3 +#class OrganizatorAutocomplete(autocomplete.Select2QuerySetView): +# def get_queryset(self): +# if not self.request.user.is_authenticated(): +# return Organizator.objects.none() +# +# qs = aktivniOrganizatori() +# +# if self.q: +# if self.q[0] == "!": +# qs = Organizator.objects.all() +# query = self.q[1:] +# else: +# query = self.q +# qs = qs.filter( +# Q(prezdivka__isstartswith=query)| +# Q(user__first_name__isstartswith=query)| +# Q(user__last_name__isstartswith=query)) +# +# return qs From c9754b98e30f71fc79240cc2598b8b70aa955f65 Mon Sep 17 00:00:00 2001 From: "Tomas \"Jethro\" Pokorny" Date: Mon, 14 Nov 2016 11:37:27 +0100 Subject: [PATCH 2/2] Barvy a preskrtnuti v seznamu korektur. --- korektury/static/korektury/opraf-list.css | 13 +++++++++++++ korektury/templates/korektury/seznam.html | 7 ++++++- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 korektury/static/korektury/opraf-list.css diff --git a/korektury/static/korektury/opraf-list.css b/korektury/static/korektury/opraf-list.css new file mode 100644 index 00000000..737b3c2c --- /dev/null +++ b/korektury/static/korektury/opraf-list.css @@ -0,0 +1,13 @@ +.adding-text{ + color: black; +} +.comitting-text +{ + color: yellow; +} +.deprecated-text { + color: red; + text-decoration: line-through; +} + + diff --git a/korektury/templates/korektury/seznam.html b/korektury/templates/korektury/seznam.html index c1d62175..991ca2c5 100644 --- a/korektury/templates/korektury/seznam.html +++ b/korektury/templates/korektury/seznam.html @@ -1,4 +1,9 @@ {% extends "korektury/base.html" %} +{% load staticfiles %} + +{% block script%} + +{% endblock %} {% block content %} @@ -12,7 +17,7 @@