gremmie@1: """ gremmie@1: This file contains the automatic admin site definitions for the downloads models. gremmie@1: """ gremmie@1: from django.contrib import admin bgneal@6: from django.conf import settings bgneal@6: gremmie@1: from downloads.models import Download gremmie@1: from downloads.models import Category gremmie@1: from downloads.models import AllowedExtension gremmie@1: from downloads.models import VoteRecord gremmie@1: bgneal@192: bgneal@192: class CategoryAdmin(admin.ModelAdmin): bgneal@192: list_display = ('title', 'description', 'count') bgneal@192: readonly_fields = ('count', ) bgneal@192: bgneal@192: gremmie@1: class DownloadAdmin(admin.ModelAdmin): bgneal@192: exclude = ('html', ) bgneal@192: list_display = ('title', 'user', 'category', 'date_added', 'ip_address', bgneal@192: 'hits', 'average_score', 'size', 'is_public') bgneal@192: list_filter = ('date_added', 'is_public', 'category', 'user', 'ip_address') bgneal@192: date_hierarchy = 'date_added' bgneal@192: ordering = ('-date_added', ) bgneal@192: search_fields = ('title', 'description', 'user__username') bgneal@192: raw_id_fields = ('user', ) bgneal@192: save_on_top = True gremmie@1: gremmie@1: gremmie@1: class VoteRecordAdmin(admin.ModelAdmin): bgneal@192: list_display = ('user', 'download', 'vote_date') bgneal@192: list_filter = ('user', 'download') bgneal@192: date_hierarchy = 'vote_date' gremmie@1: gremmie@1: gremmie@1: admin.site.register(Download, DownloadAdmin) bgneal@192: admin.site.register(Category, CategoryAdmin) gremmie@1: admin.site.register(AllowedExtension) gremmie@1: admin.site.register(VoteRecord, VoteRecordAdmin) bgneal@8: