From 28fa80045308e5d94d33c60a39bac8b0d06478b2 Mon Sep 17 00:00:00 2001 From: liangliangyy Date: Fri, 24 Mar 2017 10:49:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8E=E5=8F=B0=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comments/admin.py | 10 +++++++++- comments/models.py | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/comments/admin.py b/comments/admin.py index f6ebfa8dc..c466a290d 100644 --- a/comments/admin.py +++ b/comments/admin.py @@ -3,4 +3,12 @@ # Register your models here. from .models import Comment -admin.site.register(Comment) + +class CommentAdmin(admin.ModelAdmin): + list_display = ('id', 'body', 'author', 'article', 'last_mod_time') + list_display_links = ('id', 'body') + list_filter = ('author', 'article',) + exclude = ('created_time', 'last_mod_time') + + +admin.site.register(Comment, CommentAdmin) diff --git a/comments/models.py b/comments/models.py index 106e5cf6f..6877eef47 100644 --- a/comments/models.py +++ b/comments/models.py @@ -30,6 +30,9 @@ def send_comment_email(self, msg): except: pass + def __str__(self): + return self.body + def save(self, *args, **kwargs): super().save(*args, **kwargs) subject = '感谢您发表的评论'