#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 akaariai): I just spotted that m2m fields are allowed in the "update_fields" arg. I guess they have to be forbidden, as this could lead to confusion: "I defined 'm2m' in the update_fields, but it did not get updated. Whats going on?". Maybe removing the PK field should be done, too. You can't actually update the primary key currently, and allowing it in the update_fields is misleading. Maybe the right fix is to use something like [field.name for field in self._meta.fields if not field.primary_key] instead of get_all_field_names(). Not tested... I can take care of the above points when committing the patch. Of course, if you want to do the work I am more than happy to let you do it... :) -- Ticket URL: <https://code.djangoproject.com/ticket/4102#comment:90> 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 django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.