X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/6c9978c5bf8b1ef20871557c22b8b02df647d700..fa8171b9c389b461ecd87a6b4b1a4550a4b144ba:/contact/templatetags/contact_tags.py diff --git a/contact/templatetags/contact_tags.py b/contact/templatetags/contact_tags.py index aadba16..d8b18cb 100755 --- a/contact/templatetags/contact_tags.py +++ b/contact/templatetags/contact_tags.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- from django.template import Library + +from contact.forms import contact_forms from contact.models import Contact register = Library() @@ -8,3 +10,12 @@ register = Library() @register.filter def pretty_print(value): return Contact.pretty_print(value) + + +@register.filter +def is_enabled(form_tag): + form_class = contact_forms.get(form_tag) + if form_class: + return not getattr(form_class, 'disabled', False) + else: + return False