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

Django 1.11: Details of log - TypeError at /admin/chroniker/log/1/change/ #92

Open
luxoar opened this issue May 5, 2017 · 2 comments
Open

Comments

@luxoar
Copy link

luxoar commented May 5, 2017

Hi,
when looking at the details of a log in Django 1.11 the following error occurse. Everything works with Django 1.10. (Tested on Version 1.0.4 and 1.0.6 of django-chroniker)

Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/admin/chroniker/log/1/change/

Django Version: 1.11
Python Version: 3.5.2
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.sites',
 'django.contrib.sitemaps',
 'django_comments',
 'django_comments_xtd',
 'rosetta',
 'compressor',
 'Bildungsprojekt',
 'easy_pdf',
 'widget_tweaks',
 'haystack',
 'robots',
 'CustomerService',
 'chroniker']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'projectaxel.middleware.MyMiddleware']


Template error:
In template /home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/contrib/admin/templates/admin/includes/fieldset.html, error at line 19
   build_attrs() got an unexpected keyword argument 'name'   9 :             {% for field in line %}
   10 :                 <div{% if not line.fields|length_is:'1' %} class="field-box{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% if not field.is_readonly and field.errors %} errors{% endif %}{% if field.field.is_hidden %} hidden{% endif %}"{% elif field.is_checkbox %} class="checkbox-row"{% endif %}>
   11 :                     {% if not line.fields|length_is:'1' and not field.is_readonly %}{{ field.errors }}{% endif %}
   12 :                     {% if field.is_checkbox %}
   13 :                         {{ field.field }}{{ field.label_tag }}
   14 :                     {% else %}
   15 :                         {{ field.label_tag }}
   16 :                         {% if field.is_readonly %}
   17 :                             <div class="readonly">{{ field.contents }}</div>
   18 :                         {% else %}
   19 :                              {{ field.field }} 
   20 :                         {% endif %}
   21 :                     {% endif %}
   22 :                     {% if field.field.help_text %}
   23 :                         <div class="help">{{ field.field.help_text|safe }}</div>
   24 :                     {% endif %}
   25 :                 </div>
   26 :             {% endfor %}
   27 :         </div>
   28 :     {% endfor %}
   29 : </fieldset>


Traceback:

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
  41.             response = get_response(request)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
  217.                 response = self.process_exception_by_middleware(e, request)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
  215.                 response = response.render()

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/response.py" in render
  107.             self.content = self.rendered_content

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/response.py" in rendered_content
  84.         content = template.render(context, self._request)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/backends/django.py" in render
  66.             return self.template.render(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in render
  207.                     return self._render(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in _render
  199.         return self.nodelist.render(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/loader_tags.py" in render
  177.             return compiled_parent._render(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in _render
  199.         return self.nodelist.render(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/loader_tags.py" in render
  177.             return compiled_parent._render(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in _render
  199.         return self.nodelist.render(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/loader_tags.py" in render
  72.                 result = block.nodelist.render(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/loader_tags.py" in render
  72.                 result = block.nodelist.render(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/defaulttags.py" in render
  216.                     nodelist.append(node.render_annotated(context))

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/loader_tags.py" in render
  216.                 return template.render(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in render
  209.                 return self._render(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in _render
  199.         return self.nodelist.render(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/defaulttags.py" in render
  216.                     nodelist.append(node.render_annotated(context))

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/defaulttags.py" in render
  216.                     nodelist.append(node.render_annotated(context))

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/defaulttags.py" in render
  322.                 return nodelist.render(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/defaulttags.py" in render
  322.                 return nodelist.render(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in render
  1046.         return render_value_in_context(output, context)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/template/base.py" in render_value_in_context
  1024.     value = force_text(value)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/utils/encoding.py" in force_text
  76.                     s = six.text_type(s)

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/utils/html.py" in <lambda>
  385.         klass.__str__ = lambda self: mark_safe(klass_str(self))

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/forms/boundfield.py" in __str__
  41.         return self.as_widget()

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/django/forms/boundfield.py" in as_widget
  120.             **kwargs

File "/home/devcarl/PycharmProjects/newest_projectaxel/projectaxel/myvenv/lib/python3.5/site-packages/chroniker/admin.py" in render
  51.         final_attrs = self.build_attrs(attrs, name=name)

Exception Type: TypeError at /admin/chroniker/log/1/change/
Exception Value: build_attrs() got an unexpected keyword argument 'name'

@diegofcoelho
Copy link
Contributor

diegofcoelho commented May 6, 2017

Same over here, changing final_attrs = self.build_attrs(attrs, name=name) to final_attrs = self.build_attrs(attrs) solves the exception and show the page correctly but I don't know the implications since I could not follow its use in the library.

Also, PyCharm accuses (in chroniker's admin.py):

Signature of method 'HTMLWidget.render()' does not match signature of base method in class 'Widget' less...
on

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

@chrisspen
Copy link
Owner

I've seen this error before. I believe name is now assumed to be within the attrs dictionary. I'll need to create a unittest to confirm the fix, but I'm a bit overwhelmed with work atm.

billyquith added a commit to billyquith/django-chroniker that referenced this issue May 17, 2017
billyquith added a commit to billyquith/django-chroniker that referenced this issue May 17, 2017
chrisspen added a commit that referenced this issue Jun 17, 2017
Fix for Django 1.11 build_attrs. Issue #92.
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

3 participants