Skip to content

Commit

Permalink
Added ability to specify custom field template
Browse files Browse the repository at this point in the history
  • Loading branch information
bendavis78 committed May 4, 2014
1 parent a9bb2ac commit 0e6b83f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion formhelper/templatetags/formhelper.py
Expand Up @@ -62,7 +62,10 @@ def render(self, context):
'or must exist in context as "form"')
if not form:
raise template.TemplateSyntaxError('form is empty')
tpl = get_template('formhelper/includes/field.html')
if context.get('field_template'):
tpl = get_template(context['field_template'])
else:
tpl = get_template('formhelper/includes/field.html')
field = _get_field(self.field, form, context)
context.update({'form': form, 'field': field})
html = tpl.render(context)
Expand Down

0 comments on commit 0e6b83f

Please sign in to comment.