"zgłoś się na warsztaty" in results
[edumed.git] / contact / templatetags / contact_tags.py
index aadba16..d8b18cb 100755 (executable)
@@ -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