mirror of
https://github.com/django/django.git
synced 2025-07-24 21:54:14 +00:00
Refs #373 -- Added Model._is_pk_set() abstraction to check if a Model's PK is set.
This commit is contained in:
parent
cdbd31960e
commit
5865ff5adc
13 changed files with 67 additions and 27 deletions
|
@ -973,3 +973,14 @@ Other attributes
|
|||
since they are yet to be saved. Instances fetched from a ``QuerySet``
|
||||
will have ``adding=False`` and ``db`` set to the alias of the associated
|
||||
database.
|
||||
|
||||
``_is_pk_set()``
|
||||
----------------
|
||||
|
||||
.. method:: Model._is_pk_set()
|
||||
|
||||
.. versionadded:: 5.2
|
||||
|
||||
The ``_is_pk_set()`` method returns whether the model instance's ``pk`` is set.
|
||||
It abstracts the model's primary key definition, ensuring consistent behavior
|
||||
regardless of the specific ``pk`` configuration.
|
||||
|
|
|
@ -289,7 +289,9 @@ Database backend API
|
|||
This section describes changes that may be needed in third-party database
|
||||
backends.
|
||||
|
||||
* ...
|
||||
* The new :meth:`Model._is_pk_set() <django.db.models.Model._is_pk_set>` method
|
||||
allows checking if a Model instance's primary key is defined.
|
||||
|
||||
|
||||
:mod:`django.contrib.gis`
|
||||
-------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue