这是我的表单的定义:
class WorkflowForm(forms.Form):
new_user = forms.BooleanField(required=False)
user = ModelChoiceField(queryset=User.objects.all())
description = forms.CharField(required=False, widget=forms.Textarea)
Run Code Online (Sandbox Code Playgroud)
如果选中new_user字段,我想禁用用户ModelChoiceField 。
那么是否有可能在这个类中定义一个字段到另一个字段的依赖关系,比如在我的情况下,一个模型选择字段依赖于一个布尔字段是否被检查?