[patch]: Support for additional model.Field setting (update=True|False).
|Reported by:||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Cc:||Triage Stage:||Design decision needed|
|Has patch:||yes||Needs documentation:||yes|
|Needs tests:||yes||Patch needs improvement:||no|
Patch based on development version 4051.
The attached patches add support for an additional model field argument (update=True|False, defaulting to True) which allows the user to mark fields which should or should not be include in any update statements made on behalf of the model.
This is especially useful if the field in question is managed via an external process (like a database trigger).
class Poll (models.Model): totalVotes = models.IntegerField(default=0, editable=False, update=False)
In the above example the totalVotes column would never be included in django's update sql statement to the database.
For completeness, you may want to add a corresponding insert=True|False which applies the same rules to insert sql statements.
Change History (4)
comment:1 Changed 10 years ago by
|Triage Stage:||Unreviewed → Design decision needed|