使用 Django Admin 功能时保存方法冲突

Save method conflict when using Django Admin feature

我的模型使用自定义保存方法来添加我自己的“主键”:

class Z(models.Model):
    author = models.ForeignKey(K, on_delete=models.PROTECT)
    my_id = models.CharField(max_length=60, unique=True)
    ...
    def save(self, *args, **kwargs):
        counter = Z.objects.filter(author=self.author).count() + 1
        self.my_id = str(counter) + "/" + self.author.name
        super(Z, self).save(*args, **kwargs)

但是,当我尝试在 Django 管理面板中编辑任何内容时,它仍然使用我的保存方法——这会导致很多问题(当我编辑多个项目时,它会为其提供相同的 ID,等等)。有什么方法可以强制管理面板编辑不使用我的保存方法?

我发现了一个变通方法——在管理面板中创建了自定义函数,它在不保存任何内容的情况下实现了我想要的效果。