SciPost Code Repository

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

Improve `Submission.authors_as_list` property

parent 13a309d8
No related branches found
No related tags found
No related merge requests found
...@@ -567,14 +567,11 @@ class Submission(models.Model): ...@@ -567,14 +567,11 @@ class Submission(models.Model):
@property @property
def authors_as_list(self): def authors_as_list(self):
"""Returns a python list of the authors, extracted from author_list field.""" """Returns a python list of the authors, extracted from author_list field."""
# Start by separating in comma's comma_separated = self.author_list.replace(", and", ", ")
comma_separated = self.author_list.split(",") comma_separated = comma_separated.replace(" and ", ", ")
authors_as_list = [] comma_separated = comma_separated.replace(", & ", ", ")
for entry in comma_separated: comma_separated = comma_separated.replace(" & ", ", ")
and_separated = entry.split(" and ") return [e.lstrip().rstrip() for e in comma_separated.split(",")]
for subentry in and_separated:
authors_as_list.append(subentry.lstrip().rstrip())
return authors_as_list
def touch(self): def touch(self):
"""Update latest activity timestamp.""" """Update latest activity timestamp."""
......
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