Django/Ckeditor Error build_attrs() got an Unexpected keyword argument 'name' Request

Asked

Viewed 736 times

1

Imagem do erro

build_attrs() got an Unexpected keyword argument 'name' Request Method: GET Request URL: http://localhost:8888/admin/videos/videos/1/change/ Django Version: 1.11 Exception Type: Typeerror Exception Value:
build_attrs() got an Unexpected keyword argument 'name' Exception Location: /usr/local/lib/python3.6/site-Packages/ckeditor/widgets.py in render, line 111 Python Executable: /usr/local/opt/python3/bin/python3.6 Python Version: 3.6.0 Python Path: ['/Users/carlos/Workspace/py/www/rock', '/usr/local/Cellar/python3/3.6.0_1/Frameworks/Python.framework/Versions/3.6/lib/python36.zip', '/usr/local/Cellar/python3/3.6.0_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6', '/usr/local/Cellar/python3/3.6.0_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload', '/usr/local/lib/python3.6/site-Packages']

I’m using Python 3.6, Django 1.11, Pillow 4.0

When I disable Ckeditor everything works, then there is some incompatibility involving Ckeditor with Django 1.11.

2 answers

2


I managed to solve by downgrade Django from 1.11 to 1.10.6

I upgraded too early for the latest version of Django.

1

file widgets.py (cked), fix code

def render(self, name, value, attrs=None):
    if value is None:
        value = ''

    final_attrs = self.build_attrs(self.attrs, attrs, name=name)

    self.options['filebrowserBrowseUrl'] = reverse('cked_elfinder')

    return mark_safe(render_to_string('cked/ckeditor.html', {
        'final_attrs': flatatt(final_attrs),
        'value': conditional_escape(force_unicode(value)),
        'id': final_attrs['id'],
        'options': json_encode(self.options)})
    )

def build_attrs(self, base_attrs, extra_attrs=None, **kwargs):
    """
    Helper function for building an attribute dictionary.
    This is combination of the same method from Django<=1.10 and Django1.11+
    """
    attrs = dict(base_attrs, **kwargs)
    if extra_attrs:
        attrs.update(extra_attrs)
    return attrs

Issue 364 https://github.com/django-ckeditor/django-ckeditor/pull/364/files

  • 2

    The code is the solution? could highlight this?

  • 2

    This solution seems to me a fix of the application of ckeditor itself, right? They will release a new version with the fix?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.