#36573: "fields.E010" should not warn when field defaults are expressions
-------------------------------------+-------------------------------------
Reporter: Clifford Gama | Owner: Clifford
Type: | Gama
Cleanup/optimization | Status: closed
Component: Core (System | Version: dev
checks) |
Severity: Normal | Resolution: wontfix
Keywords: expression, default | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):
* cc: Sage Abdullah (added)
* keywords: => expression, default
* resolution: => wontfix
* status: assigned => closed
Comment:
This check only runs on `JSONField` and the postgres fields `ArrayField`
and `HStoreField`. I think you're right that `Value` isn't really what
this check is intended to complain about.
To Tim's point, though, we probably want this doc'd and tested before
encouraging further use. To me that means a new features repo ticket. For
instance, once we doc & test support for expressions in `default`, we may
find we want a system check for all fields, not just JSONField and
friends, flagging inappropriate kinds of expressions. For instance, `F()`
expressions don't really work as a default:
{{{
ValueError: Failed to insert expression "Col(plugins,
models.Plugin.name)"
on models.Plugin.slug. F() expressions can only be used to update, not to
insert.
}}}
wontfix'ing pending a new-features ticket to explore extent of support
(which would be a great idea!)
--
Ticket URL: <
https://code.djangoproject.com/ticket/36573#comment:3>