In Django's own comment framework, django-contrib-comments, it has below class defined:
In
models.py,class Comment (CommentAbstractModel):is defined.In
forms.py,class CommentForm (CommentDetailsForm):is defined.
Q: since the comment framework is a comment-db-table driven package, why not we use ModelForm to create forms from models, instead of redundantly create another CommentForm class ?
The class
CommentDetailsForminherits fromCommentSecurityForm, which defines various util methods and performs custom validation. These forms also declare fields that are not contained in theCommentmodel. Yes, it was possible to useModelForminstead ofForm, but I think that this decision is not wrong because these forms need specific behaviors,ModelFormwould have saved some lines of code (not many), but the actual implementation is more explicit. UsingModelFormwith models is not a must.