Source code for invitations.managers

__copyright__ = "Copyright © Stichting SciPost (SciPost Foundation)"
__license__ = "AGPL v3"


from django.db import models

from . import constants


[docs]class RegistrationInvitationQuerySet(models.QuerySet):
[docs] def for_contributors(self): return self.filter(invitation_type=constants.INVITATION_CONTRIBUTOR)
[docs] def for_fellows(self): return self.filter(invitation_type=constants.INVITATION_EDITORIAL_FELLOW)
[docs] def not_for_fellows(self): return self.exclude(invitation_type=constants.INVITATION_EDITORIAL_FELLOW)
[docs] def declined(self): return self.filter(status=constants.STATUS_DECLINED)
[docs] def drafts(self): return self.filter(status=constants.STATUS_DRAFT)
[docs] def declined_or_without_response(self): return self.filter( status__in=[ constants.STATUS_DECLINED, constants.STATUS_SENT, constants.STATUS_DRAFT, constants.STATUS_SENT_AND_EDITED, ] )
[docs] def sent(self): return self.filter( status__in=[constants.STATUS_SENT, constants.STATUS_SENT_AND_EDITED] )
[docs] def no_response(self): return self.filter( status__in=[ constants.STATUS_SENT, constants.STATUS_DRAFT, constants.STATUS_SENT_AND_EDITED, ] )
[docs] def invited_by(self, user): return self.filter(invited_by=user)
[docs] def created_by(self, user): return self.filter(created_by=user)
[docs]class CitationNotificationQuerySet(models.QuerySet):
[docs] def for_submissions(self): return self.filter(submission__isnull=False)
[docs] def for_publications(self): return self.filter(publication__isnull=False)
[docs] def unprocessed(self): return self.filter(processed=False)
[docs] def processed(self): return self.filter(processed=False)