我有一个模特:
class Development(models.Model):
id = models.AutoField(primary_key=True)
logno = models.CharField(max_length=13, unique=True)
insurer = models.ForeignKey(InsName, on_delete=models.SET_NULL, null=True, blank=False, verbose_name="Client")
policy = models.ManyToManyField(Policy, blank=True)
platform = models.ManyToManyField(Platform)
documents = models.ManyToManyField(Document)
active = models.BooleanField(default=True)
在开发细节模板中,我需要一个按钮,单击该按钮时会将活动字段从True更改为False。我找不到执行此操作的简单方法。我知道我需要在VIEWS.PY中做一些事情,但不确定。该按钮当前为:
<form action="" method = "POST">
<input type="submit" name="archive" class="btn btn-primary pull-right" value="Archive" />
</form>