admin.py 1.34 KB
Newer Older
1
2
from django.contrib import admin
from bt import models
3
4
5
6

class CommentInline(admin.TabularInline):
   model = models.Comment
   max_num = 1
7
8

class ViolationAdmin(admin.ModelAdmin):
9
   list_display = ('state', 'country', 'operator', 'contract', 'resource_name', 'media', 'activationid')
10
   list_filter = ('state', 'operator_ref', 'contract', 'resource_name', 'media', 'country')
11
   inlines = [CommentInline, ]
12
13
14
admin.site.register(models.Violation, ViolationAdmin)

class CommentAdmin(admin.ModelAdmin):
15
16
   list_display = ('violation', 'submitter_name', 'comment')
   list_filter = ('violation', 'submitter_name')
17
18
19
admin.site.register(models.Comment, CommentAdmin)

class AttachmentAdmin(admin.ModelAdmin):
20
   list_display = ('name', 'comment')
21
22
23
admin.site.register(models.Attachment, AttachmentAdmin)

class ConfirmationAdmin(admin.ModelAdmin):
24
   list_display = ('violation', 'key')
25
   list_filter = ('violation__operator_ref', 'violation__contract', 'violation__resource_name', 'violation__media', 'violation__country')
26
admin.site.register(models.Confirmation, ConfirmationAdmin)
27
28
29
30

class FeaturedCaseAdmin(admin.ModelAdmin):
    pass
admin.site.register(models.FeaturedCase, FeaturedCaseAdmin)
31
32
33
34
35
36

class OperatorAdmin(admin.ModelAdmin):
   list_display = ("__unicode__", "reported_violations")
   search_fields = ('name', )
   pass
admin.site.register(models.Operator, OperatorAdmin)