Merge branch 'pavel-test' into test
Zastaralé korekturovací soubory jsou nyní na zvláštní záložce a nepřekáží mezi aktuálními.
This commit is contained in:
commit
67f1fd19e5
6 changed files with 52 additions and 1 deletions
|
@ -1,5 +1,9 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block submenu %}
|
||||
{% include "korektury/submenu.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{# blok do kterého se nacita text, v pripade jinyhc templatu obalit vlastnim blokem #}
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
{% extends "korektury/base.html" %}
|
||||
|
||||
{% block submenu %}
|
||||
{% with "help" as selected %}
|
||||
{% include "korektury/submenu.html" %}
|
||||
{% endwith %}
|
||||
{% endblock %}
|
||||
|
||||
{% load staticfiles %}
|
||||
|
||||
{% block title %} Nápověda ke korigovátku {% endblock title %}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
{% extends "korektury/base.html" %}
|
||||
{% load staticfiles %}
|
||||
|
||||
{% block submenu %}
|
||||
{% include "korektury/submenu.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block script%}
|
||||
<link rel="stylesheet" type="text/css" media="screen, projection" href="{% static "korektury/opraf-list.css" %}" />
|
||||
{% endblock %}
|
||||
|
|
13
korektury/templates/korektury/submenu.html
Normal file
13
korektury/templates/korektury/submenu.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
{% with "/korektury" as cesta %}
|
||||
|
||||
<div id='submenu'>
|
||||
<ul>
|
||||
<li class="{% if selected == "aktualni" %}selected{% endif %}"><a href="{{cesta}}/">Aktuální</a>
|
||||
<li class="{% if selected == "zastarale" %}selected{% endif %}"><a href="{{cesta}}/zastarale/">Zastaralé</a>
|
||||
<li class="{% if selected == "help" %}selected{% endif %}"><a href="{{cesta}}/help/">Nápověda</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
{% endwith %}
|
||||
|
||||
|
|
@ -6,7 +6,8 @@ from . import views
|
|||
staff_member_required = user_passes_test(lambda u: u.is_staff)
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^korektury/$', staff_member_required(views.KorekturyListView.as_view()), name='korektury-list'),
|
||||
url(r'^korektury/$', staff_member_required(views.KorekturyAktualniListView.as_view()), name='korektury-list'),
|
||||
url(r'^korektury/zastarale/$', staff_member_required(views.KorekturyZastaraleListView.as_view()), name='korektury-list-zastarale'),
|
||||
url(r'^korektury/(?P<pdf>\d+)/$', staff_member_required(views.KorekturyView.as_view()), name='korektury'),
|
||||
url(r'^korektury/help/', staff_member_required(views.KorekturyHelpView.as_view()), name='korektury-help'),
|
||||
]
|
||||
|
|
|
@ -21,6 +21,28 @@ class KorekturyListView(generic.ListView):
|
|||
model = KorekturovanePDF
|
||||
template_name = 'korektury/seznam.html'
|
||||
|
||||
class KorekturyAktualniListView(KorekturyListView):
|
||||
def get_queryset(self, *args, **kwargs):
|
||||
queryset=super(KorekturyAktualniListView,self).get_queryset()
|
||||
queryset=queryset.exclude(status="zastarale")
|
||||
return queryset
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(KorekturyAktualniListView,self).get_context_data(**kwargs)
|
||||
context['selected'] = 'aktualni'
|
||||
return context
|
||||
|
||||
class KorekturyZastaraleListView(KorekturyListView):
|
||||
def get_queryset(self, *args, **kwargs):
|
||||
queryset=super(KorekturyZastaraleListView,self).get_queryset()
|
||||
queryset=queryset.filter(status="zastarale")
|
||||
return queryset
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(KorekturyZastaraleListView,self).get_context_data(**kwargs)
|
||||
context['selected'] = 'zastarale'
|
||||
return context
|
||||
|
||||
### Korektury
|
||||
class KorekturyView(generic.TemplateView):
|
||||
model = Oprava
|
||||
|
|
Loading…
Reference in a new issue