admin.py 1.41 KB
Newer Older
1 2
from django.contrib import admin
from bt import models
3

jc's avatar
jc committed
4

5
class CommentInline(admin.TabularInline):
jc's avatar
jc committed
6 7 8
    model = models.Comment
    max_num = 1

9 10

class ViolationAdmin(admin.ModelAdmin):
jc's avatar
jc committed
11 12 13 14 15
    list_display = ('state', 'country', 'operator', 'contract', 'resource_name', 'media', 'activationid', 'old', 'creation_date')
    list_filter = ('state', 'operator_ref', 'contract', 'resource_name', 'media', 'country', 'old')
    inlines = [CommentInline, ]


16 17
admin.site.register(models.Violation, ViolationAdmin)

jc's avatar
jc committed
18

19
class CommentAdmin(admin.ModelAdmin):
jc's avatar
jc committed
20 21 22 23
    list_display = ('violation', 'submitter_name', 'comment')
    list_filter = ('violation', 'submitter_name')


24 25
admin.site.register(models.Comment, CommentAdmin)

jc's avatar
jc committed
26

27
class AttachmentAdmin(admin.ModelAdmin):
jc's avatar
jc committed
28 29 30
    list_display = ('name', 'comment')


31 32
admin.site.register(models.Attachment, AttachmentAdmin)

jc's avatar
jc committed
33

34
class ConfirmationAdmin(admin.ModelAdmin):
jc's avatar
jc committed
35 36 37 38
    list_display = ('violation', 'key')
    list_filter = ('violation__operator_ref', 'violation__contract', 'violation__resource_name', 'violation__media', 'violation__country')


39
admin.site.register(models.Confirmation, ConfirmationAdmin)
40

jc's avatar
jc committed
41

42 43
class FeaturedCaseAdmin(admin.ModelAdmin):
    pass
jc's avatar
jc committed
44 45


46
admin.site.register(models.FeaturedCase, FeaturedCaseAdmin)
47

jc's avatar
jc committed
48

49
class OperatorAdmin(admin.ModelAdmin):
jc's avatar
jc committed
50 51 52 53 54 55
    list_display = ("__unicode__", "reported_violations")
    search_fields = ('name', )
    pass


admin.site.register(models.Operator, OperatorAdmin)