Permalink
Browse files

Show a boolean True/False icon in the admin if a ContentItem is not

used.
  • Loading branch information...
1 parent 5d4fc84 commit bb17d68105de6014facd2bb1540d59638dd12e00 @markotibold committed Mar 5, 2013
Showing with 7 additions and 1 deletion.
  1. +7 −1 fiber/admin.py
View
@@ -80,7 +80,7 @@ class ImageAdmin(FileAdmin):
class ContentItemAdmin(UserPermissionMixin, admin.ModelAdmin):
- list_display = ('__unicode__',)
+ list_display = ('__unicode__', 'unused')
form = forms.ContentItemAdminForm
fieldsets = (
(None, {'fields': ('name', get_editor_field_name('content_html'),)}),
@@ -90,6 +90,12 @@ class ContentItemAdmin(UserPermissionMixin, admin.ModelAdmin):
date_hierarchy = 'updated'
search_fields = ('name', get_editor_field_name('content_html'))
+ def unused(self, obj):
+ if obj.used_on_pages_data is None:
+ return True
+ return False
+ unused.boolean = True
+
class PageContentItemInline(UserPermissionMixin, admin.TabularInline):
model = PageContentItem

0 comments on commit bb17d68

Please sign in to comment.