#20791 closed Cleanup/optimization (fixed)

"Model %(model)s with pk %(pk)r does not exist."

Reported by: lsaffre Owned by: nobody
Component: Database layer (models, ORM) Version: 1.5
Severity: Normal Keywords:
Cc: eromijn@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no


I agree that this is nit-picky, but in db/models/fields/related.py (line 979 in version 1.5.1), Django issues the following message:

"Model %(model)s with pk %(pk)r does not exist."

This formulation is wrong. Not the model but a model *instance* is missing.
So I suggest to change this message to:

"%(model)s instance with pk %(pk)r does not exist."

or just:

"%(model)s with pk %(pk)r does not exist."

Change History (4)

comment:1 Changed 21 months ago by erikr

  • Cc eromijn@… added
  • Easy pickings set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Agreed, the current message can be confusing.

comment:2 Changed 21 months ago by ersran9

  • Has patch set

I have created a pull request for this : https://github.com/django/django/pull/1392

comment:3 Changed 21 months ago by erikr

  • Triage Stage changed from Accepted to Ready for checkin

The patch looks good to me. This message does not seem to be referred to in either tests or documentation, so this should be all that is needed.

comment:4 Changed 21 months ago by Claude Paroz <claude@…>

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

In 7295a8262f4f963ba7336337e2cd175be3db6f8c:

[1.6.x] Fixed #20791 -- Reworded ForeignKey default error message

Backport of 311c1d2848 from master.

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