#12238: ModelAdmin ignores dynamic fields of ModelForm
-------------------------------------------+--------------------------------
Reporter: anonymous | Owner: nobody
Status: new | Milestone:
Component: django.contrib.admin | Version: 1.1
Resolution: | Keywords: modelform
modeladmin dynamic field
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by ramiro):
* has_patch: 1 => 0
Old description:
> If a ModelForm is created and then modified to programatically add fields
> (say, in __init__), ModelAdmin ignores these fields when rendering the
> form. If one of these fields is added to the ModelForm's Meta, the field
> shows up just fine.
>
> I would expect the field to display without the coaxing in Meta.fields.
>
> 1. Create a ModelForm
> 2. Add it to ModelAdmin
> 3. View Form
> 4. Update ModelForm's __init__ to include "self.fields['xyz'] =
> forms.CharField(max_length=255, initial='keke')"
> 5. View Form (note no change)
> 6. Update ModelForm's Meta.fields to include "xyz"
> 7. View Form (note the change)
New description:
If a ModelForm is created and then modified to programatically add fields
(say, in `__init__`), !ModelAdmin ignores these fields when rendering the
form. If one of these fields is added to the !ModelForm's `Meta`, the
field shows up just fine.
I would expect the field to display without the coaxing in `Meta.fields`.
1. Create a !ModelForm
2. Add it to !ModelAdmin
3. View Form
4. Update !ModelForm's `__init__` to include `self.fields['xyz'] =
forms.CharField(max_length=255, initial='keke')`
5. View Form (note no change)
6. Update !ModelForm's `Meta.fields` to include "xyz"
7. View Form (note the change)
Comment:
(reformat description, also it hasn't a patch until it has a patch)
--
Ticket URL: <http://code.djangoproject.com/ticket/12238#comment:3>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=.