Updates a through model instance in the database for m2m relations. :param kwargs: dict of additional keyword arguments for through instance :type kwargs: Any :param child: child model instance :type child: Model
(self, child: "T", **kwargs: Any)
| 136 | await model_cls(**final_kwargs).save() |
| 137 | |
| 138 | async def update_through_instance(self, child: "T", **kwargs: Any) -> None: |
| 139 | """ |
| 140 | Updates a through model instance in the database for m2m relations. |
| 141 | |
| 142 | :param kwargs: dict of additional keyword arguments for through instance |
| 143 | :type kwargs: Any |
| 144 | :param child: child model instance |
| 145 | :type child: Model |
| 146 | """ |
| 147 | model_cls = self.relation.through |
| 148 | owner_column = self.related_field.default_target_field_name() # type: ignore |
| 149 | child_column = self.related_field.default_source_field_name() # type: ignore |
| 150 | rel_kwargs = {owner_column: self._owner.pk, child_column: child.pk} |
| 151 | through_model = await model_cls.objects.get(**rel_kwargs) |
| 152 | await through_model.update(**kwargs) |
| 153 | |
| 154 | async def upsert_through_instance(self, child: "T", **kwargs: Any) -> None: |
| 155 | """ |
no test coverage detected