Modify only one field
Hello,
Is there a better solution to modify only the specified field on a
table than :
self.__class__.objects.filter(id=self.id).update(myfield='new awesome
value')
?
I have been looking for a cleaner solution for a long time without
success, while waiting for that ( https://code.djangoproject.com/ticket/4102
).
If it is the best solution, is there any drawback with that solution ?
I suppose there is a read on the database because of the
objects.filter(). And we lose the possibility to use save() and
clean() before update, which I usually enjoy to override.
Regards,
--
Ashe
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home