diff options
author | Magnus Hagander | 2013-01-30 10:45:11 +0000 |
---|---|---|
committer | Magnus Hagander | 2013-01-30 10:45:11 +0000 |
commit | f49f53acfaaeb5b8ea1a9cb5ed5ba0ba2aac56ab (patch) | |
tree | 5ab6e3edc5aa6fcb4145cdd603c8229a4158b752 /pgweb/docs/admin.py | |
parent | 5a4e2ea7928fe70f0d89bc80ecb850a5eb4e849c (diff) |
Allow batch approval of doc comments
Diffstat (limited to 'pgweb/docs/admin.py')
-rw-r--r-- | pgweb/docs/admin.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/pgweb/docs/admin.py b/pgweb/docs/admin.py index 77ec3bbe..821f9261 100644 --- a/pgweb/docs/admin.py +++ b/pgweb/docs/admin.py @@ -1,7 +1,16 @@ 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', ) + actions = [approve_doccomment, ] admin.site.register(DocComment, DocCommentAdmin) |