Django Comments: Want to remove user URL, not expand the model. How to?

前端 未结 3 964
礼貌的吻别
礼貌的吻别 2020-12-31 08:36

I\'m totally understanding the documentation on expanding the Comments app in Django, and really would like to stick with the automatic functionality but...

3条回答
  •  渐次进展
    2020-12-31 09:04

    This is well documented under customizing the comments framework.

    All your app will use is get_form, returning a subclass of the CommentForm with the url field popped. Something like:

    class NoURLCommentForm(CommentForm):
        """
        A comment form which matches the default djanago.contrib.comments one, but
        doesn't have a URL field.
    
        """
    NoURLCommentForm.base_fields.pop('url')
    

提交回复
热议问题