#36037: Documentation mentions default primary key being regular IntegerField,
not
BigAutoField
-------------------------------------+-------------------------------------
Reporter: aripollak | Type:
| Cleanup/optimization
Status: new | Component:
| Documentation
Version: 5.1 | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Currently, Django's default primary key type is a BigAutoField. However, a
couple of pages still talk about it being an IntegerField.
Under https://docs.djangoproject.com/en/5.1/topics/db/models/#field-
options:
If you don’t specify primary_key=True for any fields in your model, Django
will automatically add an IntegerField to hold the primary key, so you
don’t need to set primary_key=True on any of your fields unless you want
to override the default primary-key behavior. For more, see Automatic
primary key fields
Under https://docs.djangoproject.com/en/5.1/ref/contrib/contenttypes
/#generic-relations:
2. Give your model a field that can store primary key values from the
models you’ll be relating to. For most models, this means a
PositiveIntegerField. The usual name for this field is “object_id”.
--
Ticket URL: <https://code.djangoproject.com/ticket/36037>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/01070193fa556e9d-7e5cd091-d16e-423c-a670-d5bc109055c3-000000%40eu-central-1.amazonses.com.