This seems like a very simple issue, and though I have a workaround I would like to fix it nicely.
EDIT: I am using a Django system, so the groups
variable is actually inherited/retrieved from a DB) I just tried to make a minimal example, but I realised that that was not conducive to solving my issue
I have a class:
class Invite(models.Model, IndexedModelMixin):
def get_associated_groups(self):
return self.groups
But when I call get_associated_groups
elsewhere
def get_groups(resource_object):
resource_group_objects = resource_object.get_associated_groups()
where Invite
is the resource_object
, this error is thrown:
get_associated_groups() missing 1 required positional argument: 'self'
My workaround currently is
resource_group_objects = resource_object.get_associated_groups(resource_object)
Why isn't the self call implicit?