comments on invalid apps shouldn't change status
@@ -29,14 +29,21 @@ def under_discussion(sender, comment, request, **kwargs):
When coordinators post a comment on an application which currently has the
PENDING status, automatically set it to 'Under discussion' (QUESTION).
"""
+ try:
application_object = Application.objects.get(pk=comment.object_pk)
-
if (
application_object.status == Application.PENDING
and application_object.editor.user.username != request.user.username
):
application_object.status = Application.QUESTION
application_object.save()
+ except Application.DoesNotExist:
+ logger.info(
+ "Status of invalid application not changed on comment {}.".format(
+ comment.object_pk
+ )
+ )
+ pass
@receiver(no_more_accounts)
