We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The case: Run query with Django's only() and did not include the tenant_field in only fields, something like below:
only()
tenant_field
bot= BotUser.objects.only("id").first() django.core.serializers.serialize("json",[bot])
We will get the RecursionError: __setattr__ > refresh_from_db > __setattr__ > refresh_from_db > ........
__setattr__
refresh_from_db
The error details are as follows: __setattr__= django_multitenant.setattr
is_val_equal_to_tenant
tenant_value
I think the checking should not be run when tenant_field not set yet
Possible fix:
def __setattr__(self, attrname, val): def is_val_equal_to_tenant(val): if self.tenant_field not in self.__dict__: return True #Skip check when `tenant_field` not set yet return......# remain unchanged .....# remain unchanged
For quick fix, just ensuring the tenant_field always set before accessing any fields
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The case: Run query with Django's
only()
and did not include thetenant_field
in only fields, something like below:We will get the RecursionError:
__setattr__
>refresh_from_db
>__setattr__
>refresh_from_db
> ........The error details are as follows:
__setattr__
= django_multitenant.setattr__setattr__
triggered to set result from DB__setattr__
triggered, triggeris_val_equal_to_tenant
buttenant_value
not set/fetched yet__setattr__
triggered to settenant_value
result from DB__setattr__
triggered,tenant_value
not able to set, because oftenant_value
not set/fetched yet (step 2)I think the checking should not be run when
tenant_field
not set yetPossible fix:
For quick fix, just ensuring the
tenant_field
always set before accessing any fieldsThe text was updated successfully, but these errors were encountered: