Changes between Version 1 and Version 3 of Ticket #28040


Ignore:
Timestamp:
Apr 20, 2017, 7:41:44 AM (7 years ago)
Author:
dpaluch-rp
Comment:

I add traceback to description, and way I fix this

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #28040 – Description

    v1 v3  
    11Error: `AttributeError: 'SplitArrayWidget' object has no attribute 'template_name'`.
     2
     3
     4Traceback:
     5
     6
     7{{{
     8
     9Template error:
     10In template /home/vagrant/apps/pg/python/templates/shared/partials/structure.html, error at line 0
     11   'SplitArrayWidget' object has no attribute 'template_name'   1 : {% load static_files %}
     12   2 : {% spaceless %}
     13   3 : <!DOCTYPE html>
     14   4 : <html lang="pl" itemscope itemtype="http://schema.org/Organization" {% block html_attrs %}{% endblock html_attrs %} {% block tracking_scripts %}data-pg="google-tag-manager" data-config-google-tag-manager="googleTagManager"{% endblock tracking_scripts %}>
     15   5 :     <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">
     16   6 :         <meta charset="utf-8">
     17   7 :         <meta http-equiv="X-UA-Compatible" content="IE=edge">
     18   8 :         {% block head %}
     19   9 :
     20   10 :             {% block meta %}
     21
     22
     23Traceback:
     24
     25File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/exception.py" in inner
     26  41.             response = get_response(request)
     27
     28File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/base.py" in _get_response
     29  217.                 response = self.process_exception_by_middleware(e, request)
     30
     31File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/base.py" in _get_response
     32  215.                 response = response.render()
     33
     34File "/usr/local/lib/python3.4/dist-packages/django/template/response.py" in render
     35  107.             self.content = self.rendered_content
     36
     37File "/usr/local/lib/python3.4/dist-packages/django/template/response.py" in rendered_content
     38  84.         content = template.render(context, self._request)
     39
     40File "/usr/local/lib/python3.4/dist-packages/django/template/backends/django.py" in render
     41  66.             return self.template.render(context)
     42
     43File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render
     44  207.                     return self._render(context)
     45
     46File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in _render
     47  199.         return self.nodelist.render(context)
     48
     49File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render
     50  990.                 bit = node.render_annotated(context)
     51
     52File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render_annotated
     53  957.             return self.render(context)
     54
     55File "/usr/local/lib/python3.4/dist-packages/django/template/loader_tags.py" in render
     56  177.             return compiled_parent._render(context)
     57
     58File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in _render
     59  199.         return self.nodelist.render(context)
     60
     61File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render
     62  990.                 bit = node.render_annotated(context)
     63
     64File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render_annotated
     65  957.             return self.render(context)
     66
     67File "/usr/local/lib/python3.4/dist-packages/django/template/loader_tags.py" in render
     68  177.             return compiled_parent._render(context)
     69
     70File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in _render
     71  199.         return self.nodelist.render(context)
     72
     73File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render
     74  990.                 bit = node.render_annotated(context)
     75
     76File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render_annotated
     77  957.             return self.render(context)
     78
     79File "/usr/local/lib/python3.4/dist-packages/django/template/loader_tags.py" in render
     80  177.             return compiled_parent._render(context)
     81
     82File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in _render
     83  199.         return self.nodelist.render(context)
     84
     85File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render
     86  990.                 bit = node.render_annotated(context)
     87
     88File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render_annotated
     89  957.             return self.render(context)
     90
     91File "/usr/local/lib/python3.4/dist-packages/django/template/defaulttags.py" in render
     92  411.         return strip_spaces_between_tags(self.nodelist.render(context).strip())
     93
     94File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render
     95  990.                 bit = node.render_annotated(context)
     96
     97File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render_annotated
     98  957.             return self.render(context)
     99
     100File "/usr/local/lib/python3.4/dist-packages/django/template/loader_tags.py" in render
     101  72.                 result = block.nodelist.render(context)
     102
     103File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render
     104  990.                 bit = node.render_annotated(context)
     105
     106File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render_annotated
     107  957.             return self.render(context)
     108
     109File "/usr/local/lib/python3.4/dist-packages/django/template/loader_tags.py" in render
     110  72.                 result = block.nodelist.render(context)
     111
     112File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render
     113  990.                 bit = node.render_annotated(context)
     114
     115File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render_annotated
     116  957.             return self.render(context)
     117
     118File "/usr/local/lib/python3.4/dist-packages/django/template/library.py" in render
     119  225.         _dict = self.func(*resolved_args, **resolved_kwargs)
     120
     121File "/home/vagrant/apps/pg/python/apps/shared/forms/templatetags/forms.py" in render_field
     122  85.     if not field:
     123
     124File "/usr/local/lib/python3.4/dist-packages/django/forms/boundfield.py" in __len__
     125  64.         return len(self.subwidgets)
     126
     127File "/usr/local/lib/python3.4/dist-packages/django/utils/functional.py" in __get__
     128  35.         res = instance.__dict__[self.name] = self.func(instance)
     129
     130File "/usr/local/lib/python3.4/dist-packages/django/forms/boundfield.py" in subwidgets
     131  57.             for widget in self.field.widget.subwidgets(self.html_name, self.value(), attrs=attrs)
     132
     133File "/usr/local/lib/python3.4/dist-packages/django/forms/boundfield.py" in <genexpr>
     134  56.             BoundWidget(self.field.widget, widget, self.form.renderer)
     135
     136File "/usr/local/lib/python3.4/dist-packages/django/forms/widgets.py" in subwidgets
     137  191.         context = self.get_context(name, value, attrs)
     138
     139File "/usr/local/lib/python3.4/dist-packages/django/forms/widgets.py" in get_context
     140  212.             'template_name': self.template_name,
     141
     142Exception Type: AttributeError at /xxxx/
     143Exception Value: 'SplitArrayWidget' object has no attribute 'template_name'
     144
     145}}}
     146
     147I'm temporary fix this in my app by subclass django Widget and add template_name property
     148
     149{{{
     150from django.contrib.postgres import forms as postgres_forms
     151
     152
     153class SplitArrayWidget(postgres_forms.SplitArrayWidget):
     154    template_name = ''
     155{{{
Back to Top