mirror of
https://github.com/django/django.git
synced 2025-06-06 20:19:13 +00:00
Fixed formatting issues and spelling in fields.txt
This commit is contained in:
parent
cd7d243561
commit
7da55b0984
@ -702,7 +702,7 @@ isn't defined.
|
|||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
When using the `db_default` attribute, the field value will be an instance of `DatabaseDefault` before the instance is saved to the database. This means that a `bool()` evaluation of the field will not reflect the specified `db_default` value until the instance is saved.
|
When using the ``db_default`` attribute, the field value will be an instance of ``DatabaseDefault`` before the instance is saved to the database. This means that a ``bool()`` evaluation of the field will not reflect the specified ``db_default`` value until the instance is saved.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
@ -721,7 +721,7 @@ isn't defined.
|
|||||||
my_obj.save()
|
my_obj.save()
|
||||||
print(bool(my_obj.my_field)) # False, as expected.
|
print(bool(my_obj.my_field)) # False, as expected.
|
||||||
|
|
||||||
To ensure the field value reflects the desired default before saving, also set the `default` attribute:
|
To ensure the field value reflects the desired default before saving, also set the ``default`` attribute:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user