Monday, April 29, 2013

AttributeError: 'AlumniResponseFormFormSet' object has no attribute 'new_objects'

I'm using the Django admin and trying to make some changes to a related object that is mapped as anInlineModelAdmin object. I'm trying to do this using the save_related(self, request, form, formsets, change) method that Django provides. When I try to save something, I get an error:

AttributeError: 'AlumniResponseFormFormSet' object has no attribute 'new_objects'

Other Info:

1) I have two InlineModelAdmins
2) I'm not saving the AlumniResponseInline when this error occurs. I'm saving another InlineModelAdmin associated with the same parent model
3) Until I added the save_related() method, I wasn't having problems saving either InlineModelAdmin
4) This error is happening after all my code is executed in save_related(), so I don't have control over catching that exception

From the documentation on save_related():

The save_related method is given the HttpRequest, the parent ModelForm instance, the list of inline formsets and a boolean value based on whether the parent is being added or changed. Here you can do any pre- or post-save operations for objects related to the parent. Note that at this point the parent object and its form have already been saved.


Thanks for your time!  

Brian Dant

PS:  I crossed posted this from SO, where I wasn't getting much traction.  I realized that this is probably more of a Django Admin detail, so y'all might know better :D

 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment