A Django application to edit files from the admin interface. This make it possible for example to let graphic designers edit some css files in the admin interface.
pip install django-dirtyedit
Add these to INSTALLED_APPS:
'dirtyedit',
'ckeditor',
'codemirror2',
'reversion',
Note: codemirror2
and reversion
should be loaded after dirtyedit
Default values are:
DIRTYEDIT_EDIT_MODE = 'code'
: uses codemirror. To use ckeditor set it to'html'
DIRTYEDIT_CODEMIRROR_KEYMAP = 'default'
: set it to what your like. Ex:'vim'
,'emacs'
DIRTYEDIT_AUTHORIZED_PATHS = ('media', 'static', 'templates')
: writing in theses directories and their subdirectories is authorized.DIRTYEDIT_EXCLUDED_PATHS = ()
: to explicitly exclude some paths. Ex:('media/private')
DIRTYEDIT_CAN_CREATE_FILES = False
: set it toTrue
to allow file creationDIRTYEDIT_USE_REVERSION = True
: set it to False to disable reversion
A management command is available to populate the database from a directory: example:
python3 manage.py populate_editor templates
This will save instances from each of the files that is in the templates
folder. Note: this is not recursive, only
the files in the directory will be processed
Handle with care: its pretty easy to break things with this module! Only give access to it to trusted admin users.
Select files:
Edit files (fullscreen edit is available):
- Handle file types to auto setup codemirror highlighting mode