Skip to content

Commit

Permalink
Improving as_uni_errors filter, so It can render formset errors
Browse files Browse the repository at this point in the history
  • Loading branch information
maraujop committed May 17, 2011
1 parent 9c5a7ac commit 9880110
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions uni_form/templatetags/uni_form_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ def as_uni_form(form, arg=None):

@register.filter
def as_uni_errors(form):
template = get_template('uni_form/errors.html')
c = Context({'form':form})
if isinstance(form, BaseFormSet):
template = get_template('uni_form/errors_formset.html')
c = Context({'formset': form})
else:
template = get_template('uni_form/errors.html')
c = Context({'form':form})
return template.render(c)

@register.filter
Expand Down

0 comments on commit 9880110

Please sign in to comment.