Removes through model instance from the database for m2m relations. :param child: child model instance :type child: Model
(self, child: "T")
| 167 | await self.create_through_instance(child=child, **kwargs) |
| 168 | |
| 169 | async def delete_through_instance(self, child: "T") -> None: |
| 170 | """ |
| 171 | Removes through model instance from the database for m2m relations. |
| 172 | |
| 173 | :param child: child model instance |
| 174 | :type child: Model |
| 175 | """ |
| 176 | queryset = ormar.QuerySet(model_cls=self.relation.through) # type: ignore |
| 177 | owner_column = self.related_field.default_target_field_name() # type: ignore |
| 178 | child_column = self.related_field.default_source_field_name() # type: ignore |
| 179 | kwargs = {owner_column: self._owner, child_column: child} |
| 180 | link_instance = await queryset.filter(**kwargs).get() # type: ignore |
| 181 | await link_instance.delete() |
| 182 | |
| 183 | async def exists(self) -> bool: |
| 184 | """ |
no test coverage detected