Don’t implement separate __getitem__ for invited users

It can inherit now because both `User.__init__` and
`InvitedUser.__init__` have the same method signature.
This commit is contained in:
Chris Hill-Scott
2019-06-05 14:54:48 +01:00
parent bd9acb1310
commit e43f78a72d

View File

@@ -528,12 +528,13 @@ class AnonymousUser(AnonymousUserMixin):
class Users(Sequence):
client = user_api_client.get_users_for_service
model = User
def __init__(self, service_id):
self.users = self.client(service_id)
def __getitem__(self, index):
return User(self.users[index])
return self.model(self.users[index])
def __len__(self):
return len(self.users)
@@ -557,9 +558,6 @@ class InvitedUsers(Users):
if user['status'] != 'accepted'
]
def __getitem__(self, index):
return self.model(self.users[index])
class OrganisationInvitedUsers(InvitedUsers):
client = org_invite_api_client.get_invites_for_organisation