1
|
|
|
from django.contrib import admin |
2
|
|
|
from django import forms |
3
|
|
|
from .models import Acc, AccCdr, MissedCall |
4
|
|
|
|
5
|
|
|
class AccAdminForm(forms.ModelForm): |
6
|
|
|
|
7
|
|
|
class Meta: |
8
|
|
|
model = Acc |
9
|
|
|
fields = '__all__' |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
class AccAdmin(admin.ModelAdmin): |
13
|
|
|
form = AccAdminForm |
14
|
|
|
list_display = ['method', 'from_tag', 'to_tag', 'callid', 'sip_code', 'sip_reason', 'time', 'time_attr', 'time_exten'] |
15
|
|
|
readonly_fields = ['method', 'from_tag', 'to_tag', 'callid', 'sip_code', 'sip_reason', 'time', 'time_attr', 'time_exten'] |
16
|
|
|
|
17
|
|
|
admin.site.register(Acc, AccAdmin) |
18
|
|
|
|
19
|
|
|
|
20
|
|
|
class AccCdrAdminForm(forms.ModelForm): |
21
|
|
|
|
22
|
|
|
class Meta: |
23
|
|
|
model = AccCdr |
24
|
|
|
fields = '__all__' |
25
|
|
|
|
26
|
|
|
|
27
|
|
|
class AccCdrAdmin(admin.ModelAdmin): |
28
|
|
|
form = AccCdrAdminForm |
29
|
|
|
list_display = ['start_time', 'end_time', 'duration'] |
30
|
|
|
readonly_fields = ['start_time', 'end_time', 'duration'] |
31
|
|
|
|
32
|
|
|
admin.site.register(AccCdr, AccCdrAdmin) |
33
|
|
|
|
34
|
|
|
|
35
|
|
|
class MissedCallAdminForm(forms.ModelForm): |
36
|
|
|
|
37
|
|
|
class Meta: |
38
|
|
|
model = MissedCall |
39
|
|
|
fields = '__all__' |
40
|
|
|
|
41
|
|
|
|
42
|
|
|
class MissedCallAdmin(admin.ModelAdmin): |
43
|
|
|
form = MissedCallAdminForm |
44
|
|
|
list_display = ['method', 'from_tag', 'to_tag', 'callid', 'sip_code', 'sip_reason', 'time'] |
45
|
|
|
readonly_fields = ['method', 'from_tag', 'to_tag', 'callid', 'sip_code', 'sip_reason', 'time'] |
46
|
|
|
|
47
|
|
|
admin.site.register(MissedCall, MissedCallAdmin) |
48
|
|
|
|