diff --git a/base/admin.py b/base/admin.py
index 0198a13..83dde79 100644
--- a/base/admin.py
+++ b/base/admin.py
@@ -15,9 +15,18 @@ admin.site.register(Feed, FeedAdmin)
class ItemAdmin(admin.ModelAdmin):
- list_display = ['mark', 'title_with_link', 'expire_date', 'published_date', 'source']
+ list_per_page = 20
+ actions_on_top = True
+ actions_on_bottom = True
+ save_on_top = True
+ readonly_fields = ['link', 'source']
+ list_display = ['mark', 'title', 'direct_link' ,'expire_date_nice',
+ 'published_date', 'source']
+ list_display_links = ['title']
list_filter = ['mark', 'source', 'expire_date']
+ list_editable = ['mark']
ordering = ['-expire_date']
+ date_hierarchy = 'expire_date'
actions = ['mark_item', 'unmark_item']
def mark_item(modeladmin, request, queryset):
diff --git a/base/models.py b/base/models.py
index 66648e8..e35cc6e 100644
--- a/base/models.py
+++ b/base/models.py
@@ -69,9 +69,19 @@ class Item(models.Model):
source = models.ForeignKey(Feed)
add_date = models.DateTimeField(auto_now_add=True)
- def title_with_link(self):
- return '%s' % (self.link, self.title)
- title_with_link.short_description = "title"
- title_with_link.allow_tags = True
- title_with_link.admin_order_field = 'title'
+ def direct_link(self):
+ return 'direct
link' % self.link
+ direct_link.short_description = ''
+ direct_link.allow_tags = True
+ direct_link.admin_order_field = 'title'
+
+ def expire_date_nice(self):
+ if self.expire_date == UNKNOWN_DATE:
+ return 'unknown'
+ else:
+ return self.expire_date
+ expire_date_nice.short_description = 'expire date'
+ expire_date_nice.allow_tags = True
+ expire_date_nice.admin_order_field = 'expire_date'
+