标签:ural 时间 中文 color col static fir editor str
class TemplateRequestLog(models.Model): templateApp = models.ForeignKey(TemplateApp, verbose_name="模板名称", on_delete=models.CASCADE) requestUrl = models.URLField(verbose_name="请求路径") createTime = models.DateTimeField(auto_now_add=True, verbose_name="创建时间") lastTime = models.DateTimeField(auto_now=True, verbose_name="修改时间") editor = models.ForeignKey(User, null=True, on_delete=models.CASCADE, verbose_name="修改者") class Meta: verbose_name_plural = "访问记录" def requestName(self): return self.editor.first_name requestName.short_description = "微信昵称" # 直接修改
def rename(newname): def decorator(fn): fn.__name__ = newname return fn return decorator class AppNews(models.Model): topImage = models.ImageField(upload_to=‘../static/uploadImage/AppNews/%Y/%m/%d‘, verbose_name=‘滚动图片‘, null=True, blank=True) createTime = models.DateTimeField(auto_now_add=True, verbose_name="创建时间") lastTime = models.DateTimeField(auto_now=True, verbose_name="修改时间") editor = models.ForeignKey(User, null=True, on_delete=models.CASCADE, verbose_name="修改者") class Meta: verbose_name_plural = "滚动新闻" @rename("模板头像") # 添加在顶部 def showTopImage(self): return format_html("<img src=‘/{}‘ class=‘showAvatar‘/>", self.topImage) def __str__(self): return self.describe
标签:ural 时间 中文 color col static fir editor str
原文地址:https://www.cnblogs.com/wangcongxing/p/11683380.html