Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#19824 closed Uncategorized (fixed)

Technically ambiguous reference docs for Field.primary_key

Reported by: Keryn Knight <django@…> Owned by: nobody
Component: Documentation Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation:
Needs tests: Patch needs improvement:
Easy pickings: no UI/UX: no

Description

In the Model Field Reference, the description for Field.primary_key says that Django will automatically add an IntegerField to hold the primary key - this is semi-correct, because Django actually provides an AutoField, itself internally represented as an IntegerField.

I've provided a proposed fix in this branch on GH. The only commit is this one, which boils down to two changes:

  • Changed IntegerField to AutoField. This should be OK, as the AutoField documentation describes it being an IntegerField.
  • Removed pluralisation in "for any fields in …", changing to "for any field in …" as there can be only one on a model.

Change History (3)

comment:1 Changed 2 years ago by Tim Graham <timograham@…>

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

In 218bbef0c4890b3b853dee945a02215533b923b7:

Fixed #19824 - Corrected the class described for Field.primary_key from IntegerField to AutoField.

Thanks Keryn Knight.

comment:2 Changed 2 years ago by Tim Graham <timograham@…>

In ba794f68bfa86c2744e89adeb6027c9d6059d85e:

[1.5.x] Fixed #19824 - Corrected the class described for Field.primary_key from IntegerField to AutoField.

Thanks Keryn Knight.

Backport of 218bbef0c4 from master

comment:3 Changed 2 years ago by Tim Graham <timograham@…>

In 57b62a74cb44ac3cf8b1a9d4cf75bfe953208814:

[1.4.x] Fixed #19824 - Corrected the class described for Field.primary_key from IntegerField to AutoField.

Thanks Keryn Knight.

Backport of 218bbef0c4 from master

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