diff --git a/django_comments/views/comments.py b/django_comments/views/comments.py index c03c3c3..40a96c7 100644 --- a/django_comments/views/comments.py +++ b/django_comments/views/comments.py @@ -15,6 +15,9 @@ from django_comments import signals from django_comments.views.utils import next_redirect, confirmation_view +UNVALID_FORM_HTTP_CODE = getattr(settings, 'COMMENT_UNVALID_FORM_HTTP_CODE', + 200) + class CommentPostBadRequest(http.HttpResponseBadRequest): """ @@ -97,7 +100,7 @@ def post_comment(request, next=None, using=None): "comment": form.data.get("comment", ""), "form": form, "next": data.get("next", next), - }, + }, status=UNVALID_FORM_HTTP_CODE ) # Otherwise create the comment diff --git a/docs/settings.txt b/docs/settings.txt index 4465852..51d2456 100644 --- a/docs/settings.txt +++ b/docs/settings.txt @@ -35,7 +35,13 @@ must also be listed in :setting:`INSTALLED_APPS`. .. setting:: COMMENTS_TIMEOUT COMMENT_TIMEOUT ------------------- +--------------- The maximum comment form timeout in seconds. The default value is ``2 * 60 * 60`` (2 hours). + +COMMENT_UNVALID_FORM_HTTP_CODE +------------------------------ + +The HTTP response code sent when unvalid form is submitted. The default value +is ``200`` (OK).