SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 6deabb29 authored by George Katsikas's avatar George Katsikas :goat:
Browse files

add try-except around publishing preprocessor

parent 0acb1b40
No related branches found
No related tags found
No related merge requests found
......@@ -7,13 +7,18 @@ from .models import Journal, Publication
def publishing_years_processor(request):
"""List of years where publishing activity took place, going backwards in time."""
return {
"publishing_years": range(
Publication.objects.published().first().publication_date.year,
Publication.objects.published().last().publication_date.year,
-1,
)
}
try:
context = {
"publishing_years": range(
Publication.objects.published().first().publication_date.year,
Publication.objects.published().last().publication_date.year,
-1,
)
}
except:
context = {"publishing_years": []}
return context
def journals_processor(request):
......
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