bennylope/django-organizations

AttributeError: 'OrganizationUser' object has no attribute 'id

bashu opened this issue · 1 comments

bashu commented

Hey,

I have custom model:

class OrganizationUser(AbstractOrganizationUser):
    uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)

Invoking delete method raises an exception:

Traceback (most recent call last):
  ...
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/organizations/abstract.py", line 126, in remove_user
    org_user.delete()
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/organizations/abstract.py", line 208, in delete
    if self.organization.owner.organization_user.id == self.id:
AttributeError: 'OrganizationUser' object has no attribute 'id'

Thanks for sharing this - looks like a case of id-itis that we can hopefully solve by replacing with pk.

Looks like that's what your PR does!