SciPost Code Repository
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SciPost
Manage
Activity
Members
Labels
Plan
Issues
118
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SciPost
SciPost
Commits
15f6a0f1
Commit
15f6a0f1
authored
3 years ago
by
Jean-Sébastien Caux
Browse files
Options
Downloads
Patches
Plain Diff
Add `has_collections` property to Journal
parent
6c33e6ab
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scipost_django/journals/models/journal.py
+7
-0
7 additions, 0 deletions
scipost_django/journals/models/journal.py
with
7 additions
and
0 deletions
scipost_django/journals/models/journal.py
+
7
−
0
View file @
15f6a0f1
...
...
@@ -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
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment