SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 15f6a0f1 authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Add `has_collections` property to Journal

parent 6c33e6ab
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,8 @@ from django.db.models import Avg, F
from django.urls import reverse
from django.utils import timezone
from series.models import Collection
from ..constants import JOURNAL_STRUCTURE, ISSUES_AND_VOLUMES, ISSUES_ONLY
from ..managers import JournalQuerySet
from ..validators import doi_journal_validator
......@@ -128,6 +130,11 @@ class Journal(models.Model):
def has_volumes(self):
return self.structure in (ISSUES_AND_VOLUMES)
@property
def has_collections(self):
return Collection.objects.filter(
series__container_journals=self).exists()
def get_issues(self):
from journals.models import Issue
if self.structure == ISSUES_AND_VOLUMES:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment