Korektury: rozdělení aktuálních a starých na dvě stránky
This commit is contained in:
		
							parent
							
								
									ba5ceb14ba
								
							
						
					
					
						commit
						2e9ff73eac
					
				
					 6 changed files with 51 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,18 @@ | |||
| {% extends "korektury/base.html" %} | ||||
| {% load staticfiles %} | ||||
| 
 | ||||
| {% block submenu %} | ||||
|   {% if aktualni %} | ||||
|     {% with "aktualni" as selected %} | ||||
|       {% include "korektury/submenu.html" %} | ||||
|     {% endwith %} | ||||
|   {% else %} | ||||
|     {% with "zastarale" as selected %} | ||||
|       {% include "korektury/submenu.html" %} | ||||
|     {% endwith %} | ||||
|   {% endif %} | ||||
| {% 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,19 @@ class KorekturyListView(generic.ListView): | |||
|     model = KorekturovanePDF | ||||
|     template_name = 'korektury/seznam.html' | ||||
| 
 | ||||
| class KorekturyAktualniListView(KorekturyListView): | ||||
|     def __init__ (self): | ||||
|         self.queryset=self.get_queryset().exclude(status="zastarale") | ||||
| 
 | ||||
|     def get_context_data(self, **kwargs): | ||||
|         context = super(KorekturyAktualniListView,self).get_context_data(**kwargs) | ||||
|         context['aktualni'] = True | ||||
|         return context | ||||
| 
 | ||||
| class KorekturyZastaraleListView(KorekturyListView): | ||||
|     def __init__ (self): | ||||
|         self.queryset=self.get_queryset().filter(status="zastarale") | ||||
| 
 | ||||
| ### Korektury | ||||
| class KorekturyView(generic.TemplateView): | ||||
|     model = Oprava | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 LEdoian
						LEdoian