Hi,
I've identified something that appears to me as a bug. I found a quick
fix, but I'd like to hear from some advised people to know what's the
best way to go, or if I'm simply missing the point.
You can copy/paste the code from:
http://dpaste.com/hold/54289/
Simply put, there are 2 models (UserProfile and Project) which both
inherit from some abstract models that centralize the management of
file galleries (one type of gallery is an avatar gallery, and the
other type is a regular file gallery).
Now, to replicate the problem in the admin, create a new project, then
create a new file gallery and set it as the 'file_gallery' attribute
for that project.
Then, try to delete the file gallery object, and you should get the
error "'FileGallery' object has no attribute 'project_filegalleried'"
as in:
http://dpaste.com/hold/54288/
The error comes from the end of the method the method at
django.db.models.base._collect_sub_objects:
for sub_obj in getattr(self, rel_opts_name).all():
sub_obj._collect_sub_objects(seen_objs)
Adding an 'hasattr' test got rid of the error:
if hasattr(self, rel_opts_name):
for sub_obj in getattr(self, rel_opts_name).all():
sub_obj._collect_sub_objects(seen_objs)
Now, does that look like a bug to you? If so, is my proposed fix
appropriate? If not, have I missed something?
Cheers,
Julien