Commits

Peter Sanchez committed 46440c8

Made quick_form tag into a filter. Added custom template name support

  • Participants
  • Parent commits 27becea
  • Branches trunk

Comments (0)

Files changed (1)

webutils/djtools/templatetags/djtools_form_tags.py

 import copy
 from django import forms
 from django import template
+from django.template.loader import render_to_string
 from django.utils.datastructures import SortedDict
 
 register = template.Library()
 
 
-@register.inclusion_tag('djtools/quick_form.html')
-def quick_form(form):
-    return {
-        'form': form,
-    }
+@register.filter
+def quick_form(form, template='djtools/quick_form.html'):
+    return render_to_string(template, {'form': form})
 
 
 '''
             'bad arguments for %r' % token.split_contents()[0]
         )
 
-    return FieldSetNode(fields.split(','), variable_name, form)
+    return FieldSetNode(fields.split(','), variable_name, form)