Source code for theses.managers

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


from django.db import models


[docs]class ThesisLinkManager(models.Manager):
[docs] def search_results(self, form): return ( self.vetted() .filter( title__icontains=form.cleaned_data["title_keyword"], author__icontains=form.cleaned_data["author"], abstract__icontains=form.cleaned_data["abstract_keyword"], supervisor__icontains=form.cleaned_data["supervisor"], ) .order_by("-defense_date") )
[docs] def latest(self, n): return self.vetted().order_by("latest_activity")[:n]
[docs] def vetted(self): return self.filter(vetted=True)
[docs] def awaiting_vetting(self): return self.filter(vetted=False)
[docs] def open_for_commenting(self): return self.filter(open_for_commenting=True)