#21454: Ignoring certain fields on INSERT and UPDATE queries
-------------------------------------+-------------------------------------
Reporter: mpessas | Owner: mpessas
Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Comment (by manfre):
This ticket seems to only address fields that are '''ALWAYS''' updated by
a trigger, but not fields that '''MAY''' be updated by a trigger (or
something else working in/against the database), but doesn't necessarily
require blocking changes on either insert or update.
This scenario seems like it should be covered by this ticket too. If so,
another field argument {{{always_refresh}}} could handle that. When
{{{always_refresh=True}}}, it would instruct the ORM to fetch the field
after an insert or update with either use of a {{{RETURNING}}} clause or a
separate fetch. When {{{always_refresh=False}}}, it would have no action,
unless {{{use_on_insert=False}}} or {{{use_on_update=False}}}.
A third field argument feels excessive, especially since you'd need to
define all three for the common case of a read-only field. The
{{{use_on_insert}}} and {{{use_on_update}}} arguments could get merged in
to an {{{edit_behavior}}} argument (probably needs a better name) that
expects one of the following constant values:
DEFAULT - {{{use_on_insert == True and use_on_update == True}}}
CREATE_ONLY - {{{use_on_insert == True and use_on_update == False}}}
UPDATE_ONLY - {{{use_on_insert == False and use_on_update == True}}}
READ_ONLY - {{{use_on_insert == False and use_on_update == False}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/21454#comment:6>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.01329637516de23cb85a82e7ab3cb60a%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.