Using a mixin with a Django form class

后端 未结 4 2058
眼角桃花
眼角桃花 2020-12-29 04:06

I\'m thinking about creating a mixin form class so that I can add a common set of fields to a variety of otherwise very different forms. Just using it as a base class won\'t

4条回答
  •  忘掉有多难
    2020-12-29 04:48

    The issue is that your NoteFormMixin is deriving from object instead of forms.Form. You need to change it to be like so:

    class NoteFormMixin(forms.Form):
        note = forms.CharField()
    

提交回复
热议问题