Opened 18 years ago

Closed 17 years ago

#3105 closed enhancement (invalid)

[patch]: Support for additional model.Field setting (update=True|False).

Reported by: Eric Van Dewoestine <ervandew@…> 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)

base.py.diff (1.6 KB ) - added by Eric Van Dewoestine <ervandew@…> 18 years ago.
django/db/models/base.py.diff
__init__.py.diff (1.2 KB ) - added by Eric Van Dewoestine <ervandew@…> 18 years ago.
django/db/models/fields/init.py.diff

Download all attachments as: .zip

Change History (4)

by Eric Van Dewoestine <ervandew@…>, 18 years ago

Attachment: base.py.diff added

django/db/models/base.py.diff

by Eric Van Dewoestine <ervandew@…>, 18 years ago

Attachment: __init__.py.diff added

django/db/models/fields/init.py.diff

comment:1 by Simon G. <dev@…>, 18 years ago

Needs documentation: set
Needs tests: set
Triage Stage: UnreviewedDesign decision needed

comment:2 by James Bennett, 17 years ago

Resolution: invalid
Status: newclosed

This really feels like specialized behavior that should be handled in a custom save method, not in Django's core.

Note: See TracTickets for help on using tickets.
Back to Top