Tagy pro menu
This commit is contained in:
parent
4a6ee24db1
commit
b6003c4094
4 changed files with 27 additions and 3 deletions
|
@ -1,3 +1,12 @@
|
||||||
{% load i18n cache %}
|
{% load i18n cache mam_menu %}
|
||||||
|
{% aktualni_rocniky as rs %}
|
||||||
|
|
||||||
MENU
|
<h2>MENU</h2>
|
||||||
|
|
||||||
|
<p><a href='{% url 'seminar.aktualni_zadani' %}'>Aktuální zadání</a>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
{% for r in rs %}
|
||||||
|
<li><a href='{% url 'seminar.rocnik' r.id %}'>Ročník {{ r }}</a>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<div>
|
<div>
|
||||||
<h2>Číslo {{ cislo }}</h2>
|
<h2>Číslo {{ cislo }}</h2>
|
||||||
|
|
||||||
<p>Ročník {% url 'seminar.rocnik' cislo.rocnik.id %}
|
<p><a href='{% url 'seminar.rocnik' cislo.rocnik.id %}'>Ročník {{ cislo.rocnik }}</a>
|
||||||
|
|
||||||
<h3>Zadané problémy</h3>
|
<h3>Zadané problémy</h3>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
0
seminar/templatetags/__init__.py
Normal file
0
seminar/templatetags/__init__.py
Normal file
15
seminar/templatetags/mam_menu.py
Normal file
15
seminar/templatetags/mam_menu.py
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
from django import template
|
||||||
|
|
||||||
|
from seminar.models import Rocnik
|
||||||
|
|
||||||
|
register = template.Library()
|
||||||
|
|
||||||
|
@register.inclusion_tag('results.html')
|
||||||
|
def seminar_rocniky(parser, token):
|
||||||
|
return {
|
||||||
|
'rocniky': Rocnik.objects.all()
|
||||||
|
}
|
||||||
|
|
||||||
|
@register.assignment_tag
|
||||||
|
def aktualni_rocniky():
|
||||||
|
return Rocnik.objects.all()
|
Loading…
Reference in a new issue