Skip to content

Commit

Permalink
fix widgets meta cannot be overridded
Browse files Browse the repository at this point in the history
  • Loading branch information
flisky committed May 22, 2012
1 parent ed588db commit 42ee05c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mongodbforms/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,11 @@ def fields_for_document(document, fields=None, exclude=None, widgets=None, \
else:
kwargs = {}

formfield = field_generator.generate(f)
if formfield_callback is not None and not callable(formfield_callback):
if formfield_callback is None:
formfield = field_generator.generate(f, **kwargs)
elif not callable(formfield_callback):
raise TypeError('formfield_callback must be a function or callable')
elif formfield_callback is not None:
else:
formfield = formfield_callback(f, **kwargs)

if formfield:
Expand Down

0 comments on commit 42ee05c

Please sign in to comment.