modelform_factory should accept widgets argument
Since Django 1.2 model forms can override widgets by specifying 'widgets' attribute in Meta, similar to 'fields' or 'exclude'. The modelform_factory doesn't accept widgets, so the only way to specify it is by defining a new parent ModelForm with Meta and giving it as 'form' argument. This is more complex than it needs to be.
The fix is to add new keyword argument widgets=None and add:
if widgets is not None:
attrs['widgets'] = widgets
right after similar if for 'exclude'. This will add 'widgets' attribute to dynamically created Meta.
milestone: |
1.3
|
Needs tests: |
set
|
Patch needs improvement: |
set
|
Triage Stage: |
Unreviewed → Accepted
|
Severity: |
→ Normal
|
Type: |
→ New feature
|
Easy pickings: |
unset
|
Owner: |
changed from nobody to Will Hardy
|
Status: |
new → assigned
|
UI/UX: |
unset
|
Needs tests: |
unset
|
Patch needs improvement: |
unset
|
Owner: |
changed from Will Hardy to nobody
|
Status: |
assigned → new
|
Triage Stage: |
Accepted → Ready for checkin
|
Resolution: |
→ fixed
|
Status: |
new → closed
|
simple patch