Work around problems if a document has two authors connected who's the

same person (fix the data issue rather than throwing an exception)
 - Legacy-Id: 4013
This commit is contained in:
Ole Laursen 2012-03-01 17:18:37 +00:00
parent 562773a081
commit 08a3ec7687

View file

@ -405,9 +405,10 @@ def update_authorsREDESIGN(draft, submission):
for author in submission.tempidauthors_set.exclude(author_order=0).order_by('author_order'):
email = ensure_person_email_info_exists(author)
try:
a = DocumentAuthor.objects.get(document=draft, author=email)
except DocumentAuthor.DoesNotExist:
a = DocumentAuthor.objects.filter(document=draft, author=email)
if a:
a = a[0]
else:
a = DocumentAuthor(document=draft, author=email)
a.order = author.author_order