Opened 7 years ago

Closed 7 years ago

Last modified 5 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: UI/UX:

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 7 years ago.
12152-2.diff (4.9 KB) - added by Matt McClanahan 7 years ago.
Better patch. I think.
12152-3.diff (4.9 KB) - added by Matt McClanahan 7 years ago.
Remove unnecessary uses of getattr
django-exception-inheritance.diff (5.0 KB) - added by Alex Gaynor 7 years ago.

Download all attachments as: .zip

Change History (9)

Changed 7 years ago by Matt McClanahan

Attachment: 12152-1.diff added

comment:1 Changed 7 years ago by Matt McClanahan

Has patch: set
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

Changed 7 years ago by Matt McClanahan

Attachment: 12152-2.diff added

Better patch. I think.

comment:2 Changed 7 years ago by Alex Gaynor

milestone: 1.2
Triage Stage: UnreviewedAccepted

Changed 7 years ago by Matt McClanahan

Attachment: 12152-3.diff added

Remove unnecessary uses of getattr

Changed 7 years ago by Alex Gaynor

comment:3 Changed 7 years ago by jkocherhans

Resolution: fixed
Status: newclosed

Fixed by r12567.

comment:4 Changed 7 years ago by jkocherhans

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

comment:5 Changed 5 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

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