Skip to content

Commit

Permalink
fix django2.1 issue
Browse files Browse the repository at this point in the history
  • Loading branch information
pylixm committed Sep 18, 2018
1 parent 7a6d07c commit 92bfb40
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 22 deletions.
45 changes: 24 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,27 +175,30 @@ admin.site.register (demo_models.ExampleModel, ExampleModelAdmin)
Add the following configuration to `settings`:
```python
MDEDITOR_CONFIGS = {
    'width': '90% ', # Custom edit box width
    'heigth': 500, # Custom edit box height
    'toolbar': ["undo", "redo", "|",
                "bold", "del", "italic", "quote", "ucwords", "uppercase", "lowercase", "|",
                "h1", "h2", "h3", "h5", "h6", "|",
                "list-ul", "list-ol", "hr", "|",
                "link", "reference-link", "image", "code", "preformatted-text", "code-block", "table", "datetime"
                "emoji", "html-entities", "pagebreak", "goto-line", "|",
                "help", "info",
                "||", "preview", "watch", "fullscreen"], # custom edit box toolbar
    'upload_image_formats': ["jpg", "jpeg", "gif", "png", "bmp", "webp"], # image upload format type
    'image_floder': 'editor', # image save the folder name
    'theme': 'default', # edit box theme, dark / default
    'preview_theme': 'default', # Preview area theme, dark / default
    'editor_theme': 'default', # edit area theme, pastel-on-dark / default
    'toolbar_autofixed': True, # Whether the toolbar capitals
    'search_replace': True, # Whether to open the search for replacement
    'emoji': True, # whether to open the expression function
    'tex': True, # whether to open the tex chart function
    'flow_chart': True, # whether to open the flow chart function
    'sequence': True # Whether to open the sequence diagram function
'default':{
'width': '90% ', # Custom edit box width
    'heigth': 500, # Custom edit box height
    'toolbar': ["undo", "redo", "|",
                "bold", "del", "italic", "quote", "ucwords", "uppercase", "lowercase", "|",
                "h1", "h2", "h3", "h5", "h6", "|",
                "list-ul", "list-ol", "hr", "|",
                "link", "reference-link", "image", "code", "preformatted-text", "code-block", "table", "datetime"
                "emoji", "html-entities", "pagebreak", "goto-line", "|",
                "help", "info",
                "||", "preview", "watch", "fullscreen"], # custom edit box toolbar
    'upload_image_formats': ["jpg", "jpeg", "gif", "png", "bmp", "webp"], # image upload format type
    'image_floder': 'editor', # image save the folder name
    'theme': 'default', # edit box theme, dark / default
    'preview_theme': 'default', # Preview area theme, dark / default
    'editor_theme': 'default', # edit area theme, pastel-on-dark / default
    'toolbar_autofixed': True, # Whether the toolbar capitals
    'search_replace': True, # Whether to open the search for replacement
    'emoji': True, # whether to open the expression function
    'tex': True, # whether to open the tex chart function
    'flow_chart': True, # whether to open the flow chart function
    'sequence': True # Whether to open the sequence diagram function
}

}
```

Expand Down
6 changes: 5 additions & 1 deletion mdeditor/widgets.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding:utf-8 -*-
from __future__ import absolute_import

from django import forms
Expand Down Expand Up @@ -74,7 +75,10 @@ def __init__(self, config_name='default', *args, **kwargs):
raise ImproperlyConfigured('CKEDITOR_CONFIGS setting must be a\
dictionary type.')

def render(self, name, value, attrs=None):
def render(self, name, value, renderer=None, attrs=None):
"""
renderer: django2.1 新增加的参数,此处不做应用,赋值None做兼容处理
"""
if value is None:
value = ''

Expand Down

0 comments on commit 92bfb40

Please sign in to comment.