feat(models): add property parent_object to models that have a parent
!22
This commit is contained in:
@ -106,6 +106,13 @@ class Team(Group, TenancyObject, SaveHistory):
|
||||
modified = AutoLastModifiedField()
|
||||
|
||||
|
||||
@property
|
||||
def parent_object(self):
|
||||
""" Fetch the parent object """
|
||||
|
||||
return self.organization
|
||||
|
||||
|
||||
def permission_list(self) -> list:
|
||||
|
||||
permission_list = []
|
||||
@ -190,3 +197,10 @@ class TeamUsers(SaveHistory):
|
||||
|
||||
user.groups.add(group)
|
||||
|
||||
|
||||
@property
|
||||
def parent_object(self):
|
||||
""" Fetch the parent object """
|
||||
|
||||
return self.team
|
||||
|
||||
|
Reference in New Issue
Block a user