class M(models.Model):
title = models.CharField(max_length=50, verbose_name='主题')
c_user = models.CharField(verbose_name='创建人', max_length=256, null=True, blank=True)
u_user = models.CharField(verbose_name='更新人', max_length=256, null=True, blank=True)
def save(self, *args, **kwargs):
if not self.pk:
self.c_user = self.user
else:
self.u_user = self.user
super().save(*args, **kwargs)