forked from arteria/cmsplugin-contact-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin.py
executable file
·31 lines (21 loc) · 927 Bytes
/
admin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from django.contrib import admin
from django.http import HttpResponse
from adminsortable.admin import SortableTabularInline, NonSortableParentAdmin
from cmsplugin_contact_plus.models import ExtraField, ContactPlus, ContactRecord
from .actions import export_as_csv_action
class ExtraFieldInline(SortableTabularInline):
model = ExtraField
fields = ('label', 'fieldType', 'initial', 'required')
class ContactFormPlusAdmin(NonSortableParentAdmin):
model = ContactPlus
inlines = (ExtraFieldInline, )
class ContactRecordAdmin(admin.ModelAdmin):
model = ContactRecord
actions = [export_as_csv_action("CSV Export",
fields = ['contact_form', 'date_of_entry', 'date_processed', 'data'],
header = True,
json_fields = ['data']), #
]
admin.site.register(ExtraField)
admin.site.register(ContactRecord, ContactRecordAdmin)
admin.site.register(ContactPlus, ContactFormPlusAdmin)