Render error tag ${form} with Django 2.1.2 , but work fine with Django 2.0.8

12 views
Skip to first unread message

Ake Tang

unread,
Oct 31, 2018, 11:09:42 PM10/31/18
to Mako Templates for Python
Hi Members,

Do u find an error such stack below? It work fine with Django 2.0.8 but until upgrade to 2.1.1


Exception Value: render() got an unexpected keyword argument 'renderer'

Environment:


Request Method: GET

Django Version: 2.1.2
Python Version: 3.7.0
Installed Applications:
[
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'formtools']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']


Template error:
In template testbase.html, error at line 22
   TypeError: render() got an unexpected keyword argument 'renderer'
   19 : <form action="." method="post">   20 : <table>   21 :     ${wizard['management_form']}   22 :      ${form}    23 : </table>   24 :    25 : <input type="submit">   26 : </form>   27 : </%def>

Traceback:

File "/i/pyenv/lib/python3.7/site-packages/django/core/handlers/exception.py" in inner
  34.             response = get_response(request)

File "/i/pyenv/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response
  156.                 response = self.process_exception_by_middleware(e, request)

File "/i/pyenv/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response
  154.                 response = response.render()

File "/i/pyenv/lib/python3.7/site-packages/django/template/response.py" in render
  106.             self.content = self.rendered_content

File "/i/pyenv/lib/python3.7/site-packages/django/template/response.py" in rendered_content
  83.         content = template.render(context, self._request)

File "/home/src/djangomako/backends.py" in render
  199.             raise e

File "/home/djangomako/backends.py" in render
  169.             return self.template.render(**context)

File "/i/pyenv/lib/python3.7/site-packages/Mako-1.0.7-py3.7.egg/mako/template.py" in render
  462.         return runtime._render(self, self.callable_, args, data)

File "/i/pyenv/lib/python3.7/site-packages/Mako-1.0.7-py3.7.egg/mako/runtime.py" in _render
  838.                     **_kwargs_for_callable(callable_, data))

File "/i/pyenv/lib/python3.7/site-packages/Mako-1.0.7-py3.7.egg/mako/runtime.py" in _render_context
  873.         _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)

File "/i/pyenv/lib/python3.7/site-packages/Mako-1.0.7-py3.7.egg/mako/runtime.py" in _exec_template
  899.         callable_(context, *args, **kwargs)

File "/tmp/testbase.html.py" in render_body
  23.         __M_writer(str(self.content()))

File "/tmp/wizard.html.py" in render_content
  75.         __M_writer(str(form))

File "/i/pyenv/lib/python3.7/site-packages/django/utils/html.py" in <lambda>
  397.     klass.__str__ = lambda self: mark_safe(klass_str(self))

File "/i/pyenv/lib/python3.7/site-packages/django/forms/forms.py" in __str__
  142.         return self.as_table()

File "/i/pyenv/lib/python3.7/site-packages/django/forms/forms.py" in as_table
  284.             errors_on_separate_row=False,

File "/i/pyenv/lib/python3.7/site-packages/django/forms/forms.py" in _html_output
  243.                     'field_name': bf.html_name,

File "/i/pyenv/lib/python3.7/site-packages/django/utils/html.py" in <lambda>
  397.     klass.__str__ = lambda self: mark_safe(klass_str(self))

File "/i/pyenv/lib/python3.7/site-packages/django/forms/boundfield.py" in __str__
  33.         return self.as_widget()

File "/i/pyenv/lib/python3.7/site-packages/django/forms/boundfield.py" in as_widget
  93.             renderer=self.form.renderer,

Exception Type: TypeError at /fh_wizard/13021/15462/
Exception Value: render() got an unexpected keyword argument 'renderer'
Reply all
Reply to author
Forward
0 new messages