#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:
Keywords: | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by mpessas):
* status: new => assigned
* needs_docs: => 0
* owner: nobody => mpessas
* needs_tests: => 0
* needs_better_patch: => 0
Comment:
Some initial comments can be found at
https://groups.google.com/forum/#!topic/django-developers/rwP2DcPYHEs.
I agree with making `use_on_insert` and `use_on_update` instance variables
instead, but my main concern is that this probably makes the variables as
important as the rest of the aguments the field can take. However, I
suppose most people should stay away from them. That is why I wanted to
make them a bit more internal to the field class. But I guess this is
actually a matter of how you document things. If the patch is merged,
should there be documentation in the Field reference page?
By the way, there is one thing I forgot to mention in my initial email,
that since the value of a field is not created from within django, the
object created or updated will not have the database-assigned value. For
instance, if there is a `created` field that takes its value from the
database, django will know that the value of the field is `None` and you
will need to read the model instance again to fetch the correct values.
But I am sure that people who need this would not mind. In any case, this
is another reason why I think this should be more of an internal thing (at
least as far as documentation is concerned).
Regarding `save`, yes this is a way to achieve a similar effect now, but
only for UPDATEs.
--
Ticket URL: <https://code.djangoproject.com/ticket/21454#comment:1>
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.4faf83cd746a150187a43820d5ef6f91%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.