# Path: boardinghouse/base.py
# class SharedSchemaModel(SharedSchemaMixin, models.Model):
#     """
#     A Base class for models that should be in the shared schema.
# 
#     You should inherit from this class if your model _must_ be in
#     the shared schema. Just setting the `_is_shared_model` attribute
#     will not be picked up for migrations.
#     """
# 
#     class Meta:
#         abstract = True


import datetime
import uuid
from django.conf import settings
from django.db import models
from django.utils import six
from django.utils.timezone import now
from django.utils.translation import ugettext_lazy as _
from boardinghouse.base import SharedSchemaModel

    def for_email(self, email):
        return self.filter(email=email)


@six.python_2_unicode_compatible
class Invitation(SharedSchemaModel):
    email = models.EmailField(verbose_name=_('Email address'))
    sender = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='sent_invitations')
    message = models.TextField()
    schema = models.ForeignKey(settings.BOARDINGHOUSE_SCHEMA_MODEL, related_name='invitations')
    redemption_code = models.UUIDField(null=True, blank=True)

    created_at = models.DateTimeField(auto_now_add=True)
    # Can we ensure that at most one of these two is not null?
    accepted_at = models.DateTimeField(null=True, blank=True)
    declined_at = models.DateTimeField(null=True, blank=True)
    accepted_by = models.ForeignKey(settings.AUTH_USER_MODEL,
                                    related_name='accepted_invitations',
                                    null=True, blank=True)

    objects = InvitationQuerySet.as_manager()

    class Meta:
        ordering = ('created_at',)
        app_label = 'invite'

    def __str__(self):
        return u'[{0!s}] Invitation to {1!s} from {2!s} to join {3!s}'.format(
            six.text_type(self.status), self.email, self.sender, self.schema.name

# Path: boardinghouse/base.py
# class SharedSchemaModel(SharedSchemaMixin, models.Model):
#     """
#     A Base class for models that should be in the shared schema.
# 
#     You should inherit from this class if your model _must_ be in
#     the shared schema. Just setting the `_is_shared_model` attribute
#     will not be picked up for migrations.
#     """
# 
#     class Meta:
#         abstract = True


# Path: boardinghouse/contrib/invite/models.py
import datetime
import uuid
from django.conf import settings
from django.db import models
from django.utils import six
from django.utils.timezone import now
from django.utils.translation import ugettext_lazy as _
from boardinghouse.base import SharedSchemaModel


    def for_email(self, email):
        return self.filter(email=email)


@six.python_2_unicode_compatible
class Invitation(SharedSchemaModel):
    email = models.EmailField(verbose_name=_('Email address'))
    sender = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='sent_invitations')
    message = models.TextField()
    schema = models.ForeignKey(settings.BOARDINGHOUSE_SCHEMA_MODEL, related_name='invitations')
    redemption_code = models.UUIDField(null=True, blank=True)

    created_at = models.DateTimeField(auto_now_add=True)
    # Can we ensure that at most one of these two is not null?
    accepted_at = models.DateTimeField(null=True, blank=True)
    declined_at = models.DateTimeField(null=True, blank=True)
    accepted_by = models.ForeignKey(settings.AUTH_USER_MODEL,
                                    related_name='accepted_invitations',
                                    null=True, blank=True)

    objects = InvitationQuerySet.as_manager()

    class Meta:
        ordering = ('created_at',)
        app_label = 'invite'

    def __str__(self):
        return u'[{0!s}] Invitation to {1!s} from {2!s} to join {3!s}'.format(
            six.text_type(self.status), self.email, self.sender, self.schema.name

        )