Opened 6 years ago

Closed 5 years ago

Last modified 4 years ago

#12152 closed (fixed)

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

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

Download all attachments as: .zip

Change History (9)

Changed 6 years ago by mattmcc

comment:1 Changed 6 years ago by mattmcc

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

Changed 6 years ago by mattmcc

Better patch. I think.

comment:2 Changed 5 years ago by Alex

  • milestone set to 1.2
  • Triage Stage changed from Unreviewed to Accepted

Changed 5 years ago by mattmcc

Remove unnecessary uses of getattr

Changed 5 years ago by Alex

comment:3 Changed 5 years ago by jkocherhans

  • Resolution set to fixed
  • Status changed from new to closed

Fixed by r12567.

comment:4 Changed 5 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 4 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

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