99814119444fb335668c1a431906c26878b673c1
[edumed.git] / curriculum / templatetags / curriculum_tags.py
1 from django import template
2 from ..models import Competence
3
4 register = template.Library()
5
6
7 @register.filter
8 def find_competence(text):
9     try:
10         return Competence.from_text(text)
11     except:
12         return None
13
14 @register.filter
15 def url_for_level(comp, level):
16     try:
17         return comp.for_level(level).get_absolute_url()
18     except:
19         return comp.get_absolute_url()
20