Ramiro:

I've set up some models / forms / formsets which demonstrate the
change here:

http://dpaste.de/YhrI/

My initial report wasn't correct - the change in behavior is only seen
when initalizing ModelFormSets . . . the ModelForm behavior is
unchanged.  With a formset, the value use to get initialized; now it
doesn't.  With a form, the value has never gotten initialized.

I think 1.1 & 1.0.3 have the same behavior (no initialization in
formsets); and SVN 10132 (1.1 beta) & 1.0.2 have the same behavior
(initialization in formsets).

On Aug 1, 6:56 pm, Ramiro Morales <cra...@gmail.com> wrote:
> On Sat, Aug 1, 2009 at 8:28 PM, David Haas<david.h.h...@gmail.com> wrote:
>
> > Hi:
>
> > I'm hoping to get some feedback on a little change in behavior I'm
> > seeing when initializing ModelForms between 1.1-beta & the official
> > 1.1 release.
>
> > The quick and dirty explanation is this: I have a ModelForm which is a
> > subclass of another ModelForm.  The parent ModelForm has the fields
> > attribute defined in its inner Meta class - the child ModelForm does
> > not.  In 1.1, when I pass in an instance of an object to initialize
> > the form, only the fields appearing in the parent ModelForm's field
> > attribute list end up with initial values - other fields are blank.
> > In 1.1-beta, all fields (whether or not they're in the parent
> > ModelForm's field list) get initial values.
>
> > In my case, I've worked around this new behavior by adding some code
> > in the child ModelForm __init__ method to set the initial values of
> > the relevant fields.  I'm just curious if the change in behavior was a
> > deliberate decision, and if not, does it merit a bug report?
>
> > And yes, I know that when you specify the fields attribute in an inner
> > Meta class, only those fields get saved to the db.  I have a system
> > with separate data entry & review, and I'm seeing this problem on the
> > review side.  During data review, no matter what gets sent out, the
> > only thing that I want to save in the database is "accept" or
> > "reject", which lives on the parent form.
>
> I'm not seeing this, I've modified Django model_forms modeltest to
> exercise what I interpret from your report and the new test passes
> and shows identical  behavior with both 1.1beta (r10133) and 1.1:
>
> http://dpaste.de/Yr0f/
>
> Please modify these tests to describe what you are seeing if I've
> missed anything.
>
> Regards,
>
> PS: Maybe you are not seein the difference in behavior at model
> instance save time as per what's described in the docs in the note
> right above this?:
>
> http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#overrid...
>
> --
> Ramiro Moraleshttp://rmorales.net
>
> PyCon 2009 Argentina - Vie 4 y Sab 5 Setiembre
> Buenos Aires, Argentinahttp://ar.pycon.org/2009/about/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to