On Mon, Jun 2, 2008 at 4:56 AM, Julien <[EMAIL PROTECTED]> wrote: > > 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? > > Do you get the error only if you delete via the Admin? If so then I think this falls under the umbrella of "Admin doesn't currently support model inheritance", see:
http://code.djangoproject.com/ticket/6755 If you can recreate the error without Admin, then that's a different issue. I'd search the ticket tracker to see if there are any other reports and if not report it. Karen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---