class CheckTask(models.Model): # ip检测任务模型 name = models.CharField(_("任务名称"), max_length=100) ip_number = models.IntegerField(_("检测ip数"), blank=True, null=True) last_time = models.DateTimeField(_("最近一次检测时间"), blank=True, null=True) check_time_strategy = models.CharField(_("检测时间"), max_length=100) check_date_strategy = models.CharField(_("检测频率"), max_length=100) create_at = models.DateTimeField(_("创建时间"), auto_now_add=True, null=True) update_at = models.DateTimeField(_("更新时间"), auto_now=True, null=True) create_by = models.CharField(_("创建人"), max_length=100, null=True, blank=True) update_by = models.CharField(_("修改人"), max_length=100, null=True, blank=True) description = models.CharField(_("描述"), max_length=500, null=True, blank=True) remark = models.CharField(_("备注"), max_length=500, null=True, blank=True) is_deleted = models.BooleanField(_("是否删除任务"), default=False) def delete(self, using=None, keep_parents=False): self.is_deleted = True self.save() def hard_delete(self, using=None): super(CheckTask, self).delete()
django 在模型中修改删除的方法
最新推荐文章于 2024-03-07 14:21:48 发布