admin.py 1.26 KB
Newer Older
1
2
from django.contrib import admin
from bt import models
3
4
5
6
7
8
from django.contrib.comments.models import Comment as DComment
from django.contrib.contenttypes import generic

class CommentInline(admin.TabularInline):
   model = models.Comment
   max_num = 1
9
10

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

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

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

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

class FeaturedCaseAdmin(admin.ModelAdmin):
    pass
admin.site.register(models.FeaturedCase, FeaturedCaseAdmin)