Closed juuisle closed 3 years ago
UPDATE: I found the specific issue, I need to add AbstractOrganizationInvitation to make it work. It seems like the code stop when it does not find AbstractOrganizationInvitation. The documentation is missing this, I think.
Suggest documentation change:
Advanced customization using abstract models As of version 0.2.0 you can add your own fully customized models using unique table sets, i.e. single table inheritance. In order to do this, your app should define an organization model, an organization user model, an organization owner model, and an organization invitation model, each inheriting from one of the abstract models provided in organizations.abstract. Here’s an example from an accounts app:
from django.db import models
from organizations.abstract import (AbstractOrganization,
AbstractOrganizationUser,
AbstractOrganizationOwner,
AbstractOrganizationInvitation)
class Account(AbstractOrganization):
monthly_subscription = models.IntegerField(default=1000)
class AccountUser(AbstractOrganizationUser):
user_type = models.CharField(max_length=1, default='')
class AccountOwner(AbstractOrganizationOwner):
pass
class AccountInvitation(AbstractOrganizationInvitation):
pass
Thanks a lot. This is not clear at all in the documentation and I lost quite a bit of time on this.
To be clear, this happened only on legacy objects when updating package from 1.1.2 to 2.2.0. When creating new objects, it worked fine.
Please fix it or add this solution in the migration documention.
Please fix it or add this solution in the migration documention.
@sebastien-powl PR's are welcome!
I tried this implementation as mentioned in the document's cookbook, but somehow the migration does not add a user field. I also added AUTH_USER_MODEL in the correct way. AUTH_USER_MODEL = 'core.UserAccount' (in my case)
Because the migration does not include the user field, there're errors: