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
|
gremmie@1
|
5 from downloads.models import Download
|
gremmie@1
|
6 from downloads.models import Category
|
gremmie@1
|
7 from downloads.models import AllowedExtension
|
gremmie@1
|
8 from downloads.models import VoteRecord
|
gremmie@1
|
9
|
gremmie@1
|
10 class DownloadAdmin(admin.ModelAdmin):
|
gremmie@1
|
11 exclude = ('html', )
|
gremmie@1
|
12 list_display = ('title', 'user', 'category', 'date_added', 'ip_address',
|
gremmie@1
|
13 'hits', 'average_score', 'size', 'is_public')
|
gremmie@1
|
14 list_filter = ('date_added', 'is_public', 'category', 'user', 'ip_address')
|
gremmie@1
|
15 date_hierarchy = 'date_added'
|
gremmie@1
|
16 ordering = ('-date_added', )
|
gremmie@1
|
17 search_fields = ('title', 'description', 'user__username')
|
gremmie@1
|
18 raw_id_fields = ('user', )
|
gremmie@1
|
19 save_on_top = True
|
gremmie@1
|
20
|
gremmie@1
|
21 class Media:
|
gremmie@1
|
22 css = {
|
gremmie@1
|
23 'all': ('js/markitup/skins/markitup/style.css',
|
gremmie@1
|
24 'js/markitup/sets/markdown/style.css')
|
gremmie@1
|
25 }
|
gremmie@1
|
26 js = (
|
gremmie@1
|
27 'js/jquery-1.2.6.min.js',
|
gremmie@1
|
28 'js/markitup/jquery.markitup.pack.js',
|
gremmie@1
|
29 'js/markitup/sets/markdown/set.js',
|
gremmie@1
|
30 'js/downloads_admin.js',
|
gremmie@1
|
31 )
|
gremmie@1
|
32
|
gremmie@1
|
33
|
gremmie@1
|
34 class VoteRecordAdmin(admin.ModelAdmin):
|
gremmie@1
|
35 list_display = ('user', 'download', 'vote_date')
|
gremmie@1
|
36 list_filter = ('user', 'download')
|
gremmie@1
|
37 date_hierarchy = 'vote_date'
|
gremmie@1
|
38
|
gremmie@1
|
39
|
gremmie@1
|
40 admin.site.register(Download, DownloadAdmin)
|
gremmie@1
|
41 admin.site.register(Category)
|
gremmie@1
|
42 admin.site.register(AllowedExtension)
|
gremmie@1
|
43 admin.site.register(VoteRecord, VoteRecordAdmin)
|