@ -24,17 +24,11 @@ class OrganizationMixin():
|
||||
|
||||
self.get_object()
|
||||
|
||||
if 'access.models.Organization' in str(type(self.get_object())):
|
||||
id = self.get_object().get_organization().id
|
||||
|
||||
id = self.get_object().id
|
||||
if self.get_object().is_global:
|
||||
|
||||
else:
|
||||
|
||||
id = self.get_object().organization.id
|
||||
|
||||
if self.get_object().is_global:
|
||||
|
||||
id = 0
|
||||
id = 0
|
||||
|
||||
except AttributeError:
|
||||
|
||||
|
@ -43,6 +43,10 @@ class Organization(SaveHistory):
|
||||
modified = AutoLastModifiedField()
|
||||
|
||||
|
||||
def get_organization(self):
|
||||
return self
|
||||
|
||||
|
||||
class TenancyObject(models.Model):
|
||||
|
||||
class Meta:
|
||||
@ -60,6 +64,9 @@ class TenancyObject(models.Model):
|
||||
blank = False
|
||||
)
|
||||
|
||||
def get_organization(self) -> Organization:
|
||||
return self.organization
|
||||
|
||||
|
||||
class Team(Group, TenancyObject, SaveHistory):
|
||||
class Meta:
|
||||
@ -140,6 +147,10 @@ class TeamUsers(SaveHistory):
|
||||
user.groups.remove(group)
|
||||
|
||||
|
||||
def get_organization(self) -> Organization:
|
||||
return self.team.organization
|
||||
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
""" Save Team
|
||||
|
||||
|
Reference in New Issue
Block a user