You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of Django 1.8.x, "module_name" in django.db.models.Model has been renamed to "model_name".
Applying model_blocks to a template in Django >= 1.8 results in this error:
Environment:
Request Method: GET
Request URL: https://django-tutorial-zudljk.c9users.io/polls/3/
Django Version: 1.10.2
Python Version: 2.7.6
Installed Applications:
['polls.apps.PollsConfig',
'model_blocks',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles']
Installed Middleware:
['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']
Template error:
In template /home/ubuntu/workspace/polls/templates/polls/detail.html, error at line 2
'Options' object has no attribute 'module_name' 1 : {% load model_blocks %}
2 : {{ question | as_detail_block }}
Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py" in inner
39. response = get_response(request)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _legacy_get_response
249. response = self._get_response(request)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/ubuntu/workspace/polls/views.py" in detail
10. return render(request, 'polls/detail.html', {'question': get_object_or_404(Question, pk=question_id)})
File "/usr/local/lib/python2.7/dist-packages/django/shortcuts.py" in render
30. content = loader.render_to_string(template_name, context, request, using=using)
File "/usr/local/lib/python2.7/dist-packages/django/template/loader.py" in render_to_string
68. return template.render(context, request)
File "/usr/local/lib/python2.7/dist-packages/django/template/backends/django.py" in render
66. return self.template.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render
208. return self._render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in _render
199. return self.nodelist.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render
994. bit = node.render_annotated(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render_annotated
961. return self.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render
1044. output = self.filter_expression.resolve(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in resolve
739. new_obj = func(obj, *arg_vals)
File "/usr/local/lib/python2.7/dist-packages/model_blocks/templatetags/model_filters.py" in as_detail_block
18. return node.render(Context({'title':title}))
File "/usr/local/lib/python2.7/dist-packages/model_blocks/templatetags/model_nodes.py" in render
56. template_variable = self.get_template_variable(thing, self.thing_type)
File "/usr/local/lib/python2.7/dist-packages/model_blocks/templatetags/model_nodes.py" in get_template_variable
31. (thing._meta.app_label, thing._meta.module_name, type_of_thing)
Exception Type: AttributeError at /polls/3/
Exception Value: 'Options' object has no attribute 'module_name'
The text was updated successfully, but these errors were encountered:
As of Django 1.8.x, "module_name" in django.db.models.Model has been renamed to "model_name".
Applying model_blocks to a template in Django >= 1.8 results in this error:
The text was updated successfully, but these errors were encountered: