Update all objects in QuerySet with given kwargs. .. admonition: Example: .. code-block:: py3 await Employee.filter(occupation='developer').update(salary=5000) Will instead of returning a resultset, update the data in the DB itself.
(self, **kwargs: Any)
| 756 | ) |
| 757 | |
| 758 | def update(self, **kwargs: Any) -> UpdateQuery: |
| 759 | """ |
| 760 | Update all objects in QuerySet with given kwargs. |
| 761 | |
| 762 | .. admonition: Example: |
| 763 | |
| 764 | .. code-block:: py3 |
| 765 | |
| 766 | await Employee.filter(occupation='developer').update(salary=5000) |
| 767 | |
| 768 | Will instead of returning a resultset, update the data in the DB itself. |
| 769 | """ |
| 770 | return UpdateQuery( |
| 771 | db=self._db, |
| 772 | model=self.model, |
| 773 | update_kwargs=kwargs, |
| 774 | q_objects=self._q_objects, |
| 775 | annotations=self._annotations, |
| 776 | custom_filters=self._custom_filters, |
| 777 | limit=self._limit, |
| 778 | orderings=self._orderings, |
| 779 | ) |
| 780 | |
| 781 | def count(self) -> CountQuery: |
| 782 | """ |