annotate gpp/downloads/admin.py @ 200:7d3e5aca095f

Fixing #73: comments no longer getting adding to web page on submit.
author Brian Neal <bgneal@gmail.com>
date Sun, 11 Apr 2010 19:41:13 +0000
parents 341759e1cda1
children b4305e18d3af
rev   line source
gremmie@1 1 """
gremmie@1 2 This file contains the automatic admin site definitions for the downloads models.
gremmie@1 3 """
gremmie@1 4 from django.contrib import admin
bgneal@6 5 from django.conf import settings
bgneal@6 6
gremmie@1 7 from downloads.models import Download
gremmie@1 8 from downloads.models import Category
gremmie@1 9 from downloads.models import AllowedExtension
gremmie@1 10 from downloads.models import VoteRecord
gremmie@1 11
bgneal@192 12
bgneal@192 13 class CategoryAdmin(admin.ModelAdmin):
bgneal@192 14 list_display = ('title', 'description', 'count')
bgneal@192 15 readonly_fields = ('count', )
bgneal@192 16
bgneal@192 17
gremmie@1 18 class DownloadAdmin(admin.ModelAdmin):
bgneal@192 19 exclude = ('html', )
bgneal@192 20 list_display = ('title', 'user', 'category', 'date_added', 'ip_address',
bgneal@192 21 'hits', 'average_score', 'size', 'is_public')
bgneal@192 22 list_filter = ('date_added', 'is_public', 'category', 'user', 'ip_address')
bgneal@192 23 date_hierarchy = 'date_added'
bgneal@192 24 ordering = ('-date_added', )
bgneal@192 25 search_fields = ('title', 'description', 'user__username')
bgneal@192 26 raw_id_fields = ('user', )
bgneal@192 27 save_on_top = True
gremmie@1 28
gremmie@1 29
gremmie@1 30 class VoteRecordAdmin(admin.ModelAdmin):
bgneal@192 31 list_display = ('user', 'download', 'vote_date')
bgneal@192 32 list_filter = ('user', 'download')
bgneal@192 33 date_hierarchy = 'vote_date'
gremmie@1 34
gremmie@1 35
gremmie@1 36 admin.site.register(Download, DownloadAdmin)
bgneal@192 37 admin.site.register(Category, CategoryAdmin)
gremmie@1 38 admin.site.register(AllowedExtension)
gremmie@1 39 admin.site.register(VoteRecord, VoteRecordAdmin)
bgneal@8 40