2011-07-31 10:46:29 +02:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- coding: utf-8 -*-
|
2012-04-25 22:29:19 +02:00
|
|
|
"""
|
|
|
|
openslides.utils.templatetags.tags
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Template tags for OpenSlides
|
|
|
|
|
|
|
|
:copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
|
|
|
|
:license: GNU GPL, see LICENSE for more details.
|
|
|
|
"""
|
2011-07-31 10:46:29 +02:00
|
|
|
|
|
|
|
from django import template
|
2012-04-14 12:52:56 +02:00
|
|
|
from config.models import config
|
2011-07-31 10:46:29 +02:00
|
|
|
|
|
|
|
register = template.Library()
|
|
|
|
|
|
|
|
@register.simple_tag
|
|
|
|
def get_min_supporters():
|
2012-02-15 12:04:11 +01:00
|
|
|
return config['application_min_supporters']
|
2011-07-31 10:46:29 +02:00
|
|
|
|
2012-04-16 16:35:30 +02:00
|
|
|
|
2011-07-31 10:46:29 +02:00
|
|
|
@register.simple_tag
|
|
|
|
def get_config(key):
|
2012-02-15 12:04:11 +01:00
|
|
|
return config[key]
|
2011-07-31 10:46:29 +02:00
|
|
|
|
2012-04-16 16:35:30 +02:00
|
|
|
|
2011-07-31 10:46:29 +02:00
|
|
|
@register.simple_tag
|
|
|
|
def active(request, pattern):
|
|
|
|
if request.path.startswith(pattern):
|
|
|
|
return 'selected'
|
|
|
|
return ''
|
2012-06-03 09:35:26 +02:00
|
|
|
|
|
|
|
@register.simple_tag
|
|
|
|
def model_url(object, link='view'):
|
|
|
|
return object.get_absolute_url(link)
|