Skip to content

Commit

Permalink
fix(access): dont use organization property within organization model
Browse files Browse the repository at this point in the history
ref: #605 #607
  • Loading branch information
jon-nfc committed Feb 19, 2025
1 parent f765fe1 commit 1663e98
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
6 changes: 0 additions & 6 deletions app/access/models/organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,6 @@ def save(self, *args, **kwargs):
modified = AutoLastModifiedField()


@property
def organization(self):

return self


def get_organization(self):
return self

Expand Down
11 changes: 9 additions & 2 deletions app/core/mixin/history_save.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,19 @@ def save_history(self, before: dict, after: dict, history_model = None) -> bool:
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,
Expand All @@ -180,7 +187,7 @@ def save_history(self, before: dict, after: dict, history_model = None) -> bool:
else:

entry = history_model.objects.create(
organization = self.organization,
organization = organization,
before = before_json,
after = after_json,
action = action,
Expand Down

0 comments on commit 1663e98

Please sign in to comment.