Skip to content

Commit

Permalink
#2737 exclude archived articles from pre-reg article page.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajrbyers committed Jun 16, 2022
1 parent 5a5e2bc commit 9f40f15
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/journal/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,11 @@ def article(request, identifier_type, identifier):
:param identifier: the identifier
:return: a rendered template of the article
"""
article_object = submission_models.Article.get_article(request.journal, identifier_type, identifier)
article_object = submission_models.Article.get_article(
request.journal,
identifier_type,
identifier,
)

content, tables_in_galley = None, None
galleys = article_object.galley_set.filter(public=True)
Expand Down
13 changes: 11 additions & 2 deletions src/submission/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1018,11 +1018,20 @@ def get_article(journal, identifier_type, identifier):
# resolve an article from an identifier type and an identifier
if identifier_type.lower() == 'id':
# this is the hardcoded fallback type: using built-in id
article = Article.objects.filter(id=identifier, journal=journal)[0]
article = Article.objects.filter(
id=identifier,
journal=journal,
).exclude(
stage=STAGE_ARCHIVED,
)[0]
else:
# this looks up an article by an ID type and an identifier string
article = identifier_models.Identifier.objects.filter(
id_type=identifier_type, identifier=identifier)[0].article
id_type=identifier_type,
identifier=identifier,
).exclude(
article__stage=STAGE_ARCHIVED,
)[0].article

if not article.journal == journal:
return None
Expand Down

0 comments on commit 9f40f15

Please # to comment.