Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#12152 closed (fixed)

A child model's DoesNotExist doesn't extend the parent's

Reported by: Matt McClanahan Owned by: nobody
Component: Database layer (models, ORM) Version: 1.1
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This should work:

class Fruit(models.Model):
    pass

class Apple(Fruit):
    pass

try:
    Apple.objects.get(id=1)
except Fruit.DoesNotExist:
    pass

Attachments (4)

12152-1.diff (6.2 KB ) - added by Matt McClanahan 14 years ago.
12152-2.diff (4.9 KB ) - added by Matt McClanahan 14 years ago.
Better patch. I think.
12152-3.diff (4.9 KB ) - added by Matt McClanahan 14 years ago.
Remove unnecessary uses of getattr
django-exception-inheritance.diff (5.0 KB ) - added by Alex Gaynor 14 years ago.

Download all attachments as: .zip

Change History (9)

by Matt McClanahan, 14 years ago

Attachment: 12152-1.diff added

comment:1 by Matt McClanahan, 14 years ago

Has patch: set

by Matt McClanahan, 14 years ago

Attachment: 12152-2.diff added

Better patch. I think.

comment:2 by Alex Gaynor, 14 years ago

milestone: 1.2
Triage Stage: UnreviewedAccepted

by Matt McClanahan, 14 years ago

Attachment: 12152-3.diff added

Remove unnecessary uses of getattr

by Alex Gaynor, 14 years ago

comment:3 by jkocherhans, 14 years ago

Resolution: fixed
Status: newclosed

Fixed by r12567.

comment:4 by jkocherhans, 14 years ago

(In [12568]) [1.1.X] Fixed #12152. DoesNotExist and MultipleObjectsReturned now subclass their parent model's exceptions. Backport of r12567 from trunk.

comment:5 by Jacob, 13 years ago

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top