SciPost Code Repository

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

fix publication metadata empty affiliations crash

truly fixes #255
reimplementation of 8a7b2a8b
parent 042191e8
No related branches found
No related tags found
No related merge requests found
......@@ -297,6 +297,10 @@ class Publication(models.Model):
for idx, aff in enumerate(self.get_all_affiliations()):
if aff in author.affiliations.all():
affnrs.append(idx + 1)
# If no affiliation is found, add a None to the list
# Prevents crashes since Django v4
if len(affnrs) == 0:
affnrs = [None]
indexed_author_list.append(affnrs)
# Since nested ArrayFields must have the same dimension,
# we pad the "empty" entries with Null:
......
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