Opened 26 hours ago

Last modified 16 hours ago

#36075 assigned Cleanup/optimization

Field.primary_key documentation should details its interaction with CompositePrimaryKey — at Version 2

Reported by: Simon Charette Owned by:
Component: Documentation Version: dev
Severity: Release blocker Keywords:
Cc: Csirmaz Bendegúz Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Simon Charette)

A particular focus should be put on the fact that the flag will and should only be set to True if the field is the single member of the primary key. When a composite primary is defined on the model this flag will be False for all the fields defined on the model and _meta.pk_fields (which should be documented) should be used instead to build composite primary key ready third-party application.

In other words, it should be made clear that code that relies solely on Field.primary_key is not composite primary key ready and that _meta.pk_fields should be used instead. I feel like this is something that should be clearly pointed out in the release notes as well.

Change History (2)

comment:1 by Simon Charette, 26 hours ago

Description: modified (diff)

comment:2 by Simon Charette, 26 hours ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top