Source code for submissions.managers.report

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


from django.db import models

from .. import constants


[docs]class ReportQuerySet(models.QuerySet): """QuerySet for the Report model."""
[docs] def accepted(self): """Return the subset of vetted Reports.""" return self.filter(status=constants.STATUS_VETTED)
[docs] def awaiting_vetting(self): """Return the subset of unvetted Reports.""" return self.filter(status=constants.STATUS_UNVETTED)
[docs] def rejected(self): """Return the subset of rejected Reports.""" return self.filter( status__in=[ constants.STATUS_UNCLEAR, constants.STATUS_INCORRECT, constants.STATUS_NOT_USEFUL, constants.STATUS_NOT_ACADEMIC, ] )
[docs] def in_draft(self): """Return the subset of Reports in draft.""" return self.filter(status=constants.STATUS_DRAFT)
[docs] def non_draft(self): """Return the subset of unvetted, vetted and rejected Reports.""" return self.exclude(status=constants.STATUS_DRAFT)
[docs] def contributed(self): """Return the subset of contributed Reports.""" return self.filter(invited=False)
[docs] def invited(self): """Return the subset of invited Reports.""" return self.filter(invited=True)