SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 92b67a1d authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Correct Comment admin

parent 92cc61da
No related branches found
No related tags found
No related merge requests found
...@@ -4,13 +4,17 @@ from .constants import STATUS_VETTED ...@@ -4,13 +4,17 @@ from .constants import STATUS_VETTED
from .models import Comment from .models import Comment
def comment_opening(comment):
return comment.comment_text[:30] + '...'
def comment_is_vetted(comment): def comment_is_vetted(comment):
'''Check if comment is vetted.''' '''Check if comment is vetted.'''
return comment.status is STATUS_VETTED return comment.status is STATUS_VETTED
class CommentAdmin(admin.ModelAdmin): class CommentAdmin(admin.ModelAdmin):
list_display = ('comment_text', 'author', 'date_submitted', comment_is_vetted) list_display = (comment_opening, 'author', 'date_submitted', comment_is_vetted)
date_hierarchy = 'date_submitted' date_hierarchy = 'date_submitted'
list_filter = ('status',) list_filter = ('status',)
comment_is_vetted.boolean = True comment_is_vetted.boolean = True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment