#35815: System check for default database values with expressions prohibits non-
expressions
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Type: Bug
Status: new | Component: Core
| (System checks)
Version: 5.0 | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Since its introduction in Django 5.0,
[https://github.com/django/django/blob/c334c1a8ff4579cdb1dd77cce8da747070ac9fc4/django/db/models/fields/__init__.py#L411-L420
the fields.E011 system check] for database backends that have
`DatabaseFeatures.supports_expression_defaults = False`
[https://github.com/django/django/blob/c334c1a8ff4579cdb1dd77cce8da747070ac9fc4/django/db/models/fields/__init__.py#L393-L398
requires literal defaults to be wrapped in Value].
There are a number of test models that have
[https://github.com/django/django/blob/c334c1a8ff4579cdb1dd77cce8da747070ac9fc4/tests/field_defaults/models.py#L46-L47
int, float] and
[https://github.com/django/django/blob/c334c1a8ff4579cdb1dd77cce8da747070ac9fc4/tests/field_defaults/models.py#L64
string] db_defaults that will raise a system check error if
`DatabaseFeatures.supports_expression_defaults = False`
since these models don't have `required_db_features =
{"supports_expression_defaults"}`.
I'm working on MongoDB which doesn't support any database defaults,
literal or expressions.
--
Ticket URL: <https://code.djangoproject.com/ticket/35815>
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 on the web visit
https://groups.google.com/d/msgid/django-updates/0107019257bfe7fa-6467f5e3-dec3-4109-bb4d-4be1066766a2-000000%40eu-central-1.amazonses.com.