forked from FLOSolutions/permabank
-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin_site.py
29 lines (25 loc) · 1.01 KB
/
admin_site.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
import django.contrib.auth.admin
import django.contrib.flatpages.admin
# apps for admin
import profiles.admin
import records.admin
import snippets.admin
# wysiwyg editor for flatpages
from django.contrib import admin
from django.contrib.flatpages.models import FlatPage
from django.contrib.flatpages.admin import FlatPageAdmin
from tinymce.widgets import TinyMCE
class TinyMCEFlatPageAdmin(FlatPageAdmin):
def formfield_for_dbfield(self, db_field, **kwargs):
if db_field.name == 'content':
return db_field.formfield(widget=TinyMCE(
attrs={'cols': 80, 'rows': 30},
mce_attrs={
'theme':'advanced',
'theme_advanced_toolbar_location':'top',
'plugins':'fullscreen,style,table,spellchecker,paste,searchreplace',
},
))
return super(TinyMCEFlatPageAdmin, self).formfield_for_dbfield(db_field, **kwargs)
admin.site.unregister(FlatPage)
admin.site.register(FlatPage, TinyMCEFlatPageAdmin)