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

Update __setattr__ method #200

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion django_multitenant/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ def __init__(self, *args, **kwargs):
def __setattr__(self, attrname, val):
# Provides failing of the save operation if the tenant_id is changed.
# try_update_tenant is being checked inside save method and if it is true, it will raise an exception.
result = super().__setattr__(attrname, val)

def is_val_equal_to_tenant(val):
return (
val
Expand All @@ -140,7 +142,7 @@ def is_val_equal_to_tenant(val):
):
self._try_update_tenant = True

return super().__setattr__(attrname, val)
return result

# pylint: disable=too-many-arguments
def _do_update(self, base_qs, using, pk_val, values, update_fields, forced_update):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

setup(
name="django-multitenant",
version="4.0.0", # Required
version="4.0.0.1", # Required
description="Django Library to Implement Multi-tenant databases",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down