Files
postgres-web/pgweb/docs/admin.py
2013-01-30 11:45:31 +01:00

18 lines
574 B
Python

from django.contrib import admin
from models import *
def approve_doccomment(modeladmin, request, queryset):
# We need to do this in a loop even though it's less efficient,
# since using queryset.update() will not send the moderation messages.
for e in queryset:
e.approved = True
e.save()
approve_doccomment.short_description = 'Approve comment'
class DocCommentAdmin(admin.ModelAdmin):
list_display = ('file', 'version', 'posted_at', 'approved', )
list_filter = ('approved', )
actions = [approve_doccomment, ]
admin.site.register(DocComment, DocCommentAdmin)