Changes between Initial Version and Version 1 of Ticket #28839


Ignore:
Timestamp:
Nov 27, 2017, 12:41:28 PM (7 years ago)
Author:
Tim Graham
Comment:

This is effectively fixed (unless Model.__str__() is overridden) in Django 2.0 by #27953 which includes the pk in the default Model.__str__(). I'm not sure if further changes should be made.

There's some related discussion in #20448.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #28839

    • Property Cc Collin Anderson added
    • Property Summary Model.__repr__ should include the pkModel.__repr__() should include the pk
    • Property Type New featureCleanup/optimization
  • Ticket #28839 – Description

    initial v1  
    11This was proposed on https://code.djangoproject.com/ticket/1055 , but it was fixed without including the PK. It was also suggested in https://code.djangoproject.com/ticket/20448 , but ignored.
    22
    3 I think the PK is very valuable as __repr__, as it allows you to retrieve the object unambiguously; while __str__ really can't have a good default implementation.
     3I think the PK is very valuable as `__repr__`, as it allows you to retrieve the object unambiguously; while __str__ really can't have a good default implementation.
Back to Top