Opened 18 years ago
Closed 17 years ago
#3105 closed enhancement (invalid)
[patch]: Support for additional model.Field setting (update=True|False).
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Design decision needed | |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | yes | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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).
Ex.
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.
Attachments (2)
Change History (4)
by , 18 years ago
Attachment: | base.py.diff added |
---|
comment:1 by , 18 years ago
Needs documentation: | set |
---|---|
Needs tests: | set |
Triage Stage: | Unreviewed → Design decision needed |
comment:2 by , 17 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
This really feels like specialized behavior that should be handled in a custom save
method, not in Django's core.
django/db/models/base.py.diff