bennylope / django-organizations

:couple: Multi-user accounts for Django projects

Home Page:http://django-organizations.readthedocs.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError: 'OrganizationUser' object has no attribute 'id

bashu opened this issue · comments

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!