[BUG] __duplicate_m2m_fields doesn't work for other db with 'through' attribute #816
Open
3 tasks done
Labels
bug
Something isn't working
Is there an existing issue for this?
Does this issue exist in the latest version?
Describe the bug?
Hello, if model field has 'through' attribute, that code doesn't use source model instance db id
https://github.com/tj-django/django-clone/blob/a401427bddc3d4be267400ce030ea08b66f92f4d/model_clone/mixin.py#L664C24-L664C24
I suggest add 'using' to 'through.objects'
objs = through.objects.using(self._state.db).filter(**{field_name: self.pk})
Or remove this 'if', and leave only code into 'else' branch. 'Else' branch work perfectly for 'through' if is exists.
To Reproduce
What OS are you seeing the problem on?
No response
Expected behavior?
Copy products from 'db-id-1'
Relevant log output
No response
Anything else?
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: