Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding admin actions for marking feeds as approved/denied

  • Loading branch information...
commit 0c02a2aec98b1a4fe399cf5be7117d42df0c0907 1 parent 4f1d3af
@justinabrahms justinabrahms authored
Showing with 11 additions and 1 deletion.
  1. +11 −1 django_website/aggregator/admin.py
View
12 django_website/aggregator/admin.py
@@ -1,7 +1,16 @@
from __future__ import absolute_import
from django.contrib import admin
-from .models import Feed, FeedItem, FeedType
+from .models import Feed, FeedItem, FeedType, APPROVED_FEED, DENIED_FEED
+
+
+def mark_approved(modeladmin, request, queryset):
+ queryset.update(approval_status=APPROVED_FEED)
+mark_approved.short_description = "Mark selected feeds as approved."
+
+def mark_denied(modeladmin, request, queryset):
+ queryset.update(approval_status=DENIED_FEED)
+mark_denied.short_description = "Mark selected feeds as denied."
admin.site.register(Feed,
list_display = ["title", "feed_type", "public_url", "approval_status"],
@@ -11,6 +20,7 @@
raw_id_fields = ['owner'],
list_editable = ["approval_status"],
list_per_page = 500,
+ actions = [mark_approved, mark_denied],
)
admin.site.register(FeedItem,
Please sign in to comment.
Something went wrong with that request. Please try again.