fix(access): dont use organization property within organization model

ref: #605 #607
This commit is contained in:
2025-02-20 05:40:01 +09:30
parent f765fe1fa0
commit 1663e98a1a
2 changed files with 9 additions and 8 deletions

View File

@ -67,12 +67,6 @@ class Organization(SaveHistory):
modified = AutoLastModifiedField()
@property
def organization(self):
return self
def get_organization(self):
return self

View File

@ -157,12 +157,19 @@ class SaveHistory(models.Model):
current_user = None
organization = getattr(self, 'organization', None)
if self._meta.model_name == 'organization':
organization = self
if before_json != after_json:
if parent_model is not None:
entry = history_model.objects.create(
organization = self.organization,
organization = organization,
before = before_json,
after = after_json,
action = action,
@ -180,7 +187,7 @@ class SaveHistory(models.Model):
else:
entry = history_model.objects.create(
organization = self.organization,
organization = organization,
before = before_json,
after = after_json,
action = action,