#4102: Allow UPDATE of only specific fields in model.save()
-------------------------------------+-------------------------------------
Reporter: Collin Grady | Owner: cgrady
<cgrady@…> | Status: new
Type: New feature | Version: master
Component: Database layer | Resolution:
(models, ORM) | Triage Stage: Accepted
Severity: Normal | Needs documentation: 0
Keywords: update fields sql | Patch needs improvement: 1
row table modified | UI/UX: 0
Has patch: 1 |
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Comment (by niwi):
Replying to [comment:87 aaugustin]:
> The code looks generally sane to me.
>
> A few remarks:
> * Does the code behave properly with related models -- ie. you can
`save(update_fields=['related'])` rather than
`save(update_fields=['related_id'])`? I haven't seen a test for this.
I will check this part and add more tests if necessary.
> * There are tests for inherited models, which is a good idea. I'm not
sufficiently familiar with the implementation of the ORM to tell if other
features (like proxy models) are worth testing. If you think they are, a
few more tests would be nice.
In my opinion, this does not affect these things. Only does the filter
fields that enter the UPDATE statement. The rest of the default behavior
is as if suddenly the model happens to have less fields than actually
have.
In any case, I see to do more tests to be sure.
> * This isn't a minor feature, it deserves a full paragraph in the
release notes.
This part of me is complicated for me. My English is not very good.
> * `tests/modeltests/update_only_fields/__init__.py` should be totally
empty.
;)
--
Ticket URL: <https://code.djangoproject.com/ticket/4102#comment:88>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.