Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'dict' object has no attribute 'iteritems' #2

Open
studiorooster opened this issue Aug 26, 2017 · 5 comments
Open

'dict' object has no attribute 'iteritems' #2

studiorooster opened this issue Aug 26, 2017 · 5 comments

Comments

@studiorooster
Copy link

I just installed the editor an am getting a 'dict' object has no attribute 'iteritems' when trying to edit the page. I can view that page from the front-end - the error only occurs on editing. Thank you for your time on creating this editor....so looking forward to replacing Hallo :)

Here is the traceback

Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/admin/pages/19/edit/

Django Version: 1.11.4
Python Version: 3.5.0
Installed Applications:
['app',
 'home',
 'django_extensions',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.sites',
 'rest_framework',
 'wagtailtinymce',
 'wagtailmedium',
 'wagtail.api.v2',
 'wagtail.contrib.settings',
 'wagtail.contrib.modeladmin',
 'wagtail.wagtailcore',
 'wagtail.wagtailadmin',
 'wagtail.wagtaildocs',
 'wagtail.wagtailsnippets',
 'wagtail.wagtailusers',
 'wagtail.wagtailimages',
 'wagtail.wagtailembeds',
 'wagtail.wagtailsearch',
 'wagtail.wagtailsites',
 'wagtail.wagtailredirects',
 'wagtail.wagtailforms',
 'wagtailmenus',
 'compressor',
 'taggit',
 'modelcluster',
 'docs',
 'wagtail.contrib.table_block',
 'raven.contrib.django.raven_compat']
Installed Middleware:
['raven.contrib.django.middleware.SentryMiddleware',
 'django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'wagtail.wagtailcore.middleware.SiteMiddleware',
 'wagtail.wagtailredirects.middleware.RedirectMiddleware']


Template error:
In template /Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/wagtail/wagtailadmin/templates/wagtailadmin/shared/field.html, error at line 7
   'dict' object has no attribute 'iteritems'   1 : {% load wagtailadmin_tags %}
   2 : <div class="field {{ field|fieldtype }} {{ field|widgettype }} {{ field_classes }}">
   3 :     {% if show_label|default_if_none:True %}{{ field.label_tag }}{% endif %}
   4 :     <div class="field-content">
   5 :         <div class="input {{ input_classes }} ">
   6 :             {% block form_field %}
   7 :                  {{ field|render_with_errors }} 
   8 :             {% endblock %}
   9 :             
   10 :             {# This span only used on rare occasions by certain types of input #}
   11 :             <span></span>
   12 :         </div>
   13 :         {% if show_help_text|default_if_none:True and field.help_text %}
   14 :             <p class="help">{{ field.help_text }}</p>
   15 :         {% endif %}
   16 : 
   17 :         {% if field|has_unrendered_errors %}


Traceback:

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
  41.             response = get_response(request)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/core/handlers/base.py" in _legacy_get_response
  249.             response = self._get_response(request)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/views/decorators/cache.py" in _cache_controlled
  43.             response = viewfunc(request, *args, **kw)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/wagtail/wagtailadmin/decorators.py" in decorated_view
  31.             return view_func(request, *args, **kwargs)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/wagtail/wagtailadmin/views/pages.py" in edit
  504.         'has_unsaved_changes': has_unsaved_changes,

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/shortcuts.py" in render
  30.     content = loader.render_to_string(template_name, context, request, using=using)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/loader.py" in render_to_string
  68.     return template.render(context, request)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/backends/django.py" in render
  66.             return self.template.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render
  207.                     return self._render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in _render
  199.         return self.nodelist.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/loader_tags.py" in render
  177.             return compiled_parent._render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in _render
  199.         return self.nodelist.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/loader_tags.py" in render
  177.             return compiled_parent._render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in _render
  199.         return self.nodelist.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/loader_tags.py" in render
  177.             return compiled_parent._render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in _render
  199.         return self.nodelist.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/loader_tags.py" in render
  177.             return compiled_parent._render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in _render
  199.         return self.nodelist.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/loader_tags.py" in render
  72.                 result = block.nodelist.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/loader_tags.py" in render
  72.                 result = block.nodelist.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render
  1040.             output = self.filter_expression.resolve(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in resolve
  708.                 obj = self.var.resolve(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in resolve
  849.             value = self._resolve_lookup(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in _resolve_lookup
  911.                             current = current()

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/wagtail/wagtailadmin/edit_handlers.py" in render_form_content
  204.         return mark_safe(self.render_as_object() + self.render_missing_fields())

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/wagtail/wagtailadmin/edit_handlers.py" in render_as_object
  172.         return self.render()

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/wagtail/wagtailadmin/edit_handlers.py" in render
  273.             'self': self

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/loader.py" in render_to_string
  68.     return template.render(context, request)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/backends/django.py" in render
  66.             return self.template.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render
  207.                     return self._render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in _render
  199.         return self.nodelist.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/defaulttags.py" in render
  216.                     nodelist.append(node.render_annotated(context))

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render
  1040.             output = self.filter_expression.resolve(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in resolve
  708.                 obj = self.var.resolve(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in resolve
  849.             value = self._resolve_lookup(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in _resolve_lookup
  911.                             current = current()

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/wagtail/wagtailadmin/edit_handlers.py" in render_as_object
  172.         return self.render()

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/wagtail/wagtailadmin/edit_handlers.py" in render
  273.             'self': self

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/loader.py" in render_to_string
  68.     return template.render(context, request)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/backends/django.py" in render
  66.             return self.template.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render
  207.                     return self._render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in _render
  199.         return self.nodelist.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/defaulttags.py" in render
  216.                     nodelist.append(node.render_annotated(context))

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render
  1040.             output = self.filter_expression.resolve(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in resolve
  708.                 obj = self.var.resolve(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in resolve
  849.             value = self._resolve_lookup(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in _resolve_lookup
  911.                             current = current()

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/wagtail/wagtailadmin/edit_handlers.py" in render_as_object
  454.             'field': self.bound_field,

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/loader.py" in render_to_string
  68.     return template.render(context, request)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/backends/django.py" in render
  66.             return self.template.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render
  207.                     return self._render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in _render
  199.         return self.nodelist.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/loader_tags.py" in render
  216.                 return template.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render
  209.                 return self._render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in _render
  199.         return self.nodelist.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/loader_tags.py" in render
  63.                 result = self.nodelist.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in render
  1040.             output = self.filter_expression.resolve(context)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/template/base.py" in resolve
  736.                 new_obj = func(obj, *arg_vals)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/wagtail/wagtailadmin/templatetags/wagtailadmin_tags.py" in render_with_errors
  256.         return bound_field.as_widget()

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/forms/boundfield.py" in as_widget
  127.             **kwargs

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/wagtailmedium/rich_text.py" in render
  131.         return super(MediumRichTextArea, self).render(name, translated_value, attrs)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/wagtail/utils/widgets.py" in render
  22.         js = self.render_js_init(id_, name, value)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/wagtailmedium/rich_text.py" in render_js_init
  170.         medium_config_string = build_medium_js_config(self.options)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/wagtailmedium/rich_text.py" in build_medium_js_config
  38.     for name, config in custom_buttons.iteritems():

Exception Type: AttributeError at /admin/pages/19/edit/
Exception Value: 'dict' object has no attribute 'iteritems'
@dperetti
Copy link
Owner

What's your settings.WAGTAILADMIN_RICH_TEXT_EDITORS ?

@studiorooster
Copy link
Author

studiorooster commented Aug 26, 2017

I just copied and pasted

'medium': {
        'WIDGET': 'wagtailmedium.rich_text.MediumRichTextArea',
        'OPTIONS': {
            'custom_buttons': {
                'code': {
                    'contentDefault': '<b>Code</b>',
                    'contentFA': '<i class="fa fa-code"></i>',
                    'tag': 'code',
                    'className': 'code',  # optional
                },
                'test': {
                    'contentDefault': '<b>Test</b>',
                    'contentFA': '<i class="fa fa-code"></i>',
                    'tag': 'span',
                    'className': 'test',  # optional
                },
            },
            'medium': {  # https://github.com/yabwe/medium-editor#options-example
                # 'buttonLabels': 'fontawesome',
                'toolbar': {
                    'buttons': [  # https://github.com/yabwe/medium-editor#all-buttons
                        'bold', 'italic', 'underline',
                        'code',
                        'test',
                        'link',
                        'linkdoc',
                        'h2', 'h3', 'orderedlist', 'unorderedlist', 'strikethrough'
                    ]
                },
            },
        },
    },

@studiorooster
Copy link
Author

And my model
content = RichTextField(editor='medium', blank=True)

@dperetti
Copy link
Owner

Hmm obviously, it's not python 3 ready 😣. Will fix this in the coming week!

@studiorooster
Copy link
Author

studiorooster commented Aug 26, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants