Skip to content

Commit

Permalink
Merge pull request #4309 from kobotoolbox/add-email-to-organization
Browse files Browse the repository at this point in the history
Add Organization Owner's email to Organization model
  • Loading branch information
bufke committed Mar 6, 2023
2 parents c1eb348 + f7f2d35 commit 5f6c0fe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions kobo/apps/organizations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
class Organization(AbstractOrganization):
uid = KpiUidField(uid_prefix='org')

@property
def email(self):
"""
As organization is our customer model for Stripe, Stripe requires that
it has an email address attribute
"""
return self.owner.organization_user.user.email


class OrganizationUser(AbstractOrganizationUser):
pass
Expand Down
1 change: 1 addition & 0 deletions kobo/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,7 @@ def __init__(self, *args, **kwargs):


''' Django allauth configuration '''
# User.email should continue to be used instead of the EmailAddress model
ACCOUNT_ADAPTER = 'kobo.apps.accounts.adapter.AccountAdapter'
ACCOUNT_USERNAME_VALIDATORS = 'kobo.apps.accounts.validators.username_validators'
ACCOUNT_EMAIL_REQUIRED = True
Expand Down

0 comments on commit 5f6c0fe

Please sign in to comment.