On Apr 18, 11:08 pm, Chris <chriss...@gmail.com> wrote: > I have an inline form used in my admin that looks up the value for the > associated model, and dynamically selects the form field widget that's > appropriate for the data. The class looks like: > > class MyModelInlineForm(ModelForm): > attribute_model = ModelChoiceField(queryset=None) > def __init__(self,*args,**kwargs): > ...do stuff... > > if not self.instance._adding: > attribute = self.instance.attribute_model > self.fields['value'] = > get_form_field_for_attribute(attribute, self.instance) > > However, after upgrading to Django 1.3 from 1.2.3, viewing any admin > pages using this form throws the exception: > > AttributeError: 'MyModel' object has no attribute '_adding' > > I can't find any documentation on the instance._adding attribute, or > how it would have changed since 1.2.3. I've been digging through the > code, but I'm quite stuck. How do I resolve this?
If I am not mistaken this attribute has been moved: instance._adding - > instance.state.adding. See django/db/models/base.py ModelState class and Model.__init__ method. - Anssi -- 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.