Ticket #15315: models.py.diff

File models.py.diff, 1.1 KB (added by SardarNL, 5 years ago)

simple patch

Line 
1*** models.py   Sun Feb 13 20:55:51 2011
2--- amodels.py  Wed Feb 16 13:05:37 2011
3***************
4*** 380,386 ****
5      __metaclass__ = ModelFormMetaclass
6 
7  def modelform_factory(model, form=ModelForm, fields=None, exclude=None,
8!                        formfield_callback=None):
9      # Create the inner Meta class. FIXME: ideally, we should be able to
10      # construct a ModelForm without creating and passing in a temporary
11      # inner class.
12--- 380,386 ----
13      __metaclass__ = ModelFormMetaclass
14 
15  def modelform_factory(model, form=ModelForm, fields=None, exclude=None,
16!                        widgets=None, formfield_callback=None):
17      # Create the inner Meta class. FIXME: ideally, we should be able to
18      # construct a ModelForm without creating and passing in a temporary
19      # inner class.
20***************
21*** 391,396 ****
22--- 391,398 ----
23          attrs['fields'] = fields
24      if exclude is not None:
25          attrs['exclude'] = exclude
26+     if widgets is not None:
27+         attrs['widgets'] = widgets
28 
29      # If parent form class already has an inner Meta, the Meta we're
30      # creating needs to inherit from the parent's inner meta.
Back to Top