#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)
Change History (9)
by , 15 years ago
Attachment: | 12152-1.diff added |
---|
comment:1 by , 15 years ago
Has patch: | set |
---|
by , 15 years ago
Attachment: | 12152-2.diff added |
---|
comment:2 by , 15 years ago
milestone: | → 1.2 |
---|---|
Triage Stage: | Unreviewed → Accepted |
by , 15 years ago
Attachment: | django-exception-inheritance.diff added |
---|
comment:4 by , 15 years ago
(In [12568]) [1.1.X] Fixed #12152. DoesNotExist and MultipleObjectsReturned now subclass their parent model's exceptions. Backport of r12567 from trunk.
Note:
See TracTickets
for help on using tickets.
Better patch. I think.