如果另一个字段(is_invoiced)为True,换句话说,选中此复选框,我将尝试从表单中隐藏一个布尔字段(is_completed)。
我的模型如下:
class Woo_Orders(models.Model):
is_invoiced = models.BooleanField("Invoiced?",default=False)
is_completed = models.BooleanField("Completed?",default=False)
在表单中,我想我必须调用def clean_is_invoiced函数,如下面的代码片段。
def clean_is_invoiced(self):
is_invoiced = self.cleaned_data['is_invoiced']
if is_invoiced==False:
#hide the is_completed
return is_invoiced
但是如何隐藏is_completed按钮?