[Django]-A user with no email can't post a comment using Django's comments framework

3👍

Well, you can use the customization documentation to create a custom app that handles comments from comments framework. You should set COMMENTS_APP = 'my_comment_app' in your settings file and specify a get_form() method in your app’s __init__.py which should return your custom form.

The custom form should be based on contrib.comments.forms.CommentForm and should look something like that:

class CustomForm(comment_forms.CommentForm):
    def __init__(*args, **kwargs):
        super(CustomFors, self).__init__(*args, **kwargs)
        self.fields["email"].required = False

preview.html is rendered because the form contains errors (emai is required, but user doesn’t have it and so it’s not populated). If there are no errors – preview won’t be shown.

Leave a comment