Skip to content

Commit

Permalink
Handle unsetting of pub date #4095
Browse files Browse the repository at this point in the history
  • Loading branch information
joemull authored and mauromsl committed May 30, 2024
1 parent 2e5c963 commit 2a2b7c4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/journal/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1090,15 +1090,20 @@ def publish_article(request, article_id):
instance=article,
)
if pub_date_form.is_valid():
pub_date_form.save()
messages.add_message(
request, messages.SUCCESS,
_(
f'Publication date set to { article.date_published.strftime("%Y-%m-%d %H:%M %Z") } '
f'({ naturaltime(article.date_published) })'
article = pub_date_form.save()
if article.date_published:
messages.add_message(
request, messages.SUCCESS,
_(
f'Publication date set to { article.date_published.strftime("%Y-%m-%d %H:%M %Z") } '
f'({ naturaltime(article.date_published) })'
)
)
else:
messages.add_message(
request, messages.SUCCESS,
_('Publication date unset')
)
)

else:
messages.add_message(
request, messages.WARNING,
Expand Down
1 change: 1 addition & 0 deletions src/submission/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,3 +539,4 @@ def save(self, commit=True):
)
article.fixedpubcheckitems.save()
article.save()
return article

0 comments on commit 2a2b7c4

Please sign in to comment.