InternForm
一般的なメッセージやウィジェットなどを継承しModelForm
て定義 する「ジェネリック」があります。
誰もがアクセスできるアプリケーションフォームと呼ばれるサブクラスを定義しましたApplyInternForm
。「高度な」フィールドの一部を非表示にします。
exclude
フォームのサブクラスの設定を上書きするにはどうすればよいですか?
class InternForm(ModelForm):
# ...
class Meta:
model = Intern
exclude = ()
class ApplyInternForm(InternForm):
def __init__(self, *args, **kwargs):
super(ApplyInternForm, self).__init__(*args, **kwargs)
self.Meta.exclude = ('is_active',) # this doesn't work