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/#overriding-the-default-field-types -- Ramiro Morales http://rmorales.net PyCon 2009 Argentina - Vie 4 y Sab 5 Setiembre Buenos Aires, Argentina http://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 -~----------~----~----~----~------~----~------~--~---