Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrap_many_related_manager_add tries to update through_defaults, assuming it is a dict. It is None by default #168

Open
pbav opened this issue Apr 3, 2023 · 0 comments

Comments

@pbav
Copy link

pbav commented Apr 3, 2023

Python 3.10.6
Django 4.0.9
django-multitenant 3.2

def wrap_many_related_manager_add(many_related_manager_add):
...
    def add(self, *objs, through_defaults=None):
...
        if hasattr(self.through, "tenant_field") and get_current_tenant():
            through_defaults[
                get_tenant_column(self.through)
            ] = get_current_tenant_value()
File ".../django/db/models/fields/related_descriptors.py", line 1130, in set
    self.add(*new_objs, through_defaults=through_defaults)
File ".../django_multitenant/mixins.py", line 42, in add
    through_defaults[
TypeError: 'NoneType' object does not support item assignment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant