mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
[5.0.x] Fixed #34944 -- Made GeneratedField.output_field required.
Regression inf333e3513e. Backport of5875f03ce6from main
This commit is contained in:
@@ -1243,7 +1243,7 @@ when :attr:`~django.forms.Field.localize` is ``False`` or
|
||||
|
||||
.. versionadded:: 5.0
|
||||
|
||||
.. class:: GeneratedField(expression, db_persist=None, output_field=None, **kwargs)
|
||||
.. class:: GeneratedField(expression, output_field, db_persist=None, **kwargs)
|
||||
|
||||
A field that is always computed based on other fields in the model. This field
|
||||
is managed and updated by the database itself. Uses the ``GENERATED ALWAYS``
|
||||
@@ -1265,6 +1265,10 @@ materialized view.
|
||||
the model (in the same database table). Generated fields cannot reference
|
||||
other generated fields. Database backends can impose further restrictions.
|
||||
|
||||
.. attribute:: GeneratedField.output_field
|
||||
|
||||
A model field instance to define the field's data type.
|
||||
|
||||
.. attribute:: GeneratedField.db_persist
|
||||
|
||||
Determines if the database column should occupy storage as if it were a
|
||||
@@ -1274,12 +1278,6 @@ materialized view.
|
||||
PostgreSQL only supports persisted columns. Oracle only supports virtual
|
||||
columns.
|
||||
|
||||
.. attribute:: GeneratedField.output_field
|
||||
|
||||
An optional model field instance to define the field's data type. This can
|
||||
be used to customize attributes like the field's collation. By default, the
|
||||
output field is derived from ``expression``.
|
||||
|
||||
.. admonition:: Refresh the data
|
||||
|
||||
Since the database always computed the value, the object must be reloaded
|
||||
|
||||
Reference in New Issue
Block a user