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: gremmie@1: class DownloadAdmin(admin.ModelAdmin): gremmie@1: exclude = ('html', ) gremmie@1: list_display = ('title', 'user', 'category', 'date_added', 'ip_address', gremmie@1: 'hits', 'average_score', 'size', 'is_public') gremmie@1: list_filter = ('date_added', 'is_public', 'category', 'user', 'ip_address') gremmie@1: date_hierarchy = 'date_added' gremmie@1: ordering = ('-date_added', ) gremmie@1: search_fields = ('title', 'description', 'user__username') gremmie@1: raw_id_fields = ('user', ) gremmie@1: save_on_top = True gremmie@1: gremmie@1: class Media: gremmie@1: css = { bgneal@6: 'all': settings.GPP_THIRD_PARTY_CSS['markitup'], gremmie@1: } bgneal@6: js = settings.GPP_THIRD_PARTY_JS['jquery'] + \ bgneal@6: settings.GPP_THIRD_PARTY_JS['markitup'] + \ bgneal@6: ('js/downloads_admin.js', ) gremmie@1: gremmie@1: gremmie@1: class VoteRecordAdmin(admin.ModelAdmin): gremmie@1: list_display = ('user', 'download', 'vote_date') gremmie@1: list_filter = ('user', 'download') gremmie@1: date_hierarchy = 'vote_date' gremmie@1: gremmie@1: gremmie@1: admin.site.register(Download, DownloadAdmin) gremmie@1: admin.site.register(Category) gremmie@1: admin.site.register(AllowedExtension) gremmie@1: admin.site.register(VoteRecord, VoteRecordAdmin)