Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion comments/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
3 changes: 3 additions & 0 deletions comments/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '感谢您发表的评论'
Expand Down