| 2 | |
| 3 | |
| 4 | Traceback: |
| 5 | |
| 6 | |
| 7 | {{{ |
| 8 | |
| 9 | Template error: |
| 10 | In 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 | |
| 23 | Traceback: |
| 24 | |
| 25 | File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/exception.py" in inner |
| 26 | 41. response = get_response(request) |
| 27 | |
| 28 | File "/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 | |
| 31 | File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/base.py" in _get_response |
| 32 | 215. response = response.render() |
| 33 | |
| 34 | File "/usr/local/lib/python3.4/dist-packages/django/template/response.py" in render |
| 35 | 107. self.content = self.rendered_content |
| 36 | |
| 37 | File "/usr/local/lib/python3.4/dist-packages/django/template/response.py" in rendered_content |
| 38 | 84. content = template.render(context, self._request) |
| 39 | |
| 40 | File "/usr/local/lib/python3.4/dist-packages/django/template/backends/django.py" in render |
| 41 | 66. return self.template.render(context) |
| 42 | |
| 43 | File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render |
| 44 | 207. return self._render(context) |
| 45 | |
| 46 | File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in _render |
| 47 | 199. return self.nodelist.render(context) |
| 48 | |
| 49 | File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render |
| 50 | 990. bit = node.render_annotated(context) |
| 51 | |
| 52 | File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render_annotated |
| 53 | 957. return self.render(context) |
| 54 | |
| 55 | File "/usr/local/lib/python3.4/dist-packages/django/template/loader_tags.py" in render |
| 56 | 177. return compiled_parent._render(context) |
| 57 | |
| 58 | File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in _render |
| 59 | 199. return self.nodelist.render(context) |
| 60 | |
| 61 | File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render |
| 62 | 990. bit = node.render_annotated(context) |
| 63 | |
| 64 | File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render_annotated |
| 65 | 957. return self.render(context) |
| 66 | |
| 67 | File "/usr/local/lib/python3.4/dist-packages/django/template/loader_tags.py" in render |
| 68 | 177. return compiled_parent._render(context) |
| 69 | |
| 70 | File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in _render |
| 71 | 199. return self.nodelist.render(context) |
| 72 | |
| 73 | File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render |
| 74 | 990. bit = node.render_annotated(context) |
| 75 | |
| 76 | File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render_annotated |
| 77 | 957. return self.render(context) |
| 78 | |
| 79 | File "/usr/local/lib/python3.4/dist-packages/django/template/loader_tags.py" in render |
| 80 | 177. return compiled_parent._render(context) |
| 81 | |
| 82 | File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in _render |
| 83 | 199. return self.nodelist.render(context) |
| 84 | |
| 85 | File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render |
| 86 | 990. bit = node.render_annotated(context) |
| 87 | |
| 88 | File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render_annotated |
| 89 | 957. return self.render(context) |
| 90 | |
| 91 | File "/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 | |
| 94 | File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render |
| 95 | 990. bit = node.render_annotated(context) |
| 96 | |
| 97 | File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render_annotated |
| 98 | 957. return self.render(context) |
| 99 | |
| 100 | File "/usr/local/lib/python3.4/dist-packages/django/template/loader_tags.py" in render |
| 101 | 72. result = block.nodelist.render(context) |
| 102 | |
| 103 | File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render |
| 104 | 990. bit = node.render_annotated(context) |
| 105 | |
| 106 | File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render_annotated |
| 107 | 957. return self.render(context) |
| 108 | |
| 109 | File "/usr/local/lib/python3.4/dist-packages/django/template/loader_tags.py" in render |
| 110 | 72. result = block.nodelist.render(context) |
| 111 | |
| 112 | File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render |
| 113 | 990. bit = node.render_annotated(context) |
| 114 | |
| 115 | File "/usr/local/lib/python3.4/dist-packages/django/template/base.py" in render_annotated |
| 116 | 957. return self.render(context) |
| 117 | |
| 118 | File "/usr/local/lib/python3.4/dist-packages/django/template/library.py" in render |
| 119 | 225. _dict = self.func(*resolved_args, **resolved_kwargs) |
| 120 | |
| 121 | File "/home/vagrant/apps/pg/python/apps/shared/forms/templatetags/forms.py" in render_field |
| 122 | 85. if not field: |
| 123 | |
| 124 | File "/usr/local/lib/python3.4/dist-packages/django/forms/boundfield.py" in __len__ |
| 125 | 64. return len(self.subwidgets) |
| 126 | |
| 127 | File "/usr/local/lib/python3.4/dist-packages/django/utils/functional.py" in __get__ |
| 128 | 35. res = instance.__dict__[self.name] = self.func(instance) |
| 129 | |
| 130 | File "/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 | |
| 133 | File "/usr/local/lib/python3.4/dist-packages/django/forms/boundfield.py" in <genexpr> |
| 134 | 56. BoundWidget(self.field.widget, widget, self.form.renderer) |
| 135 | |
| 136 | File "/usr/local/lib/python3.4/dist-packages/django/forms/widgets.py" in subwidgets |
| 137 | 191. context = self.get_context(name, value, attrs) |
| 138 | |
| 139 | File "/usr/local/lib/python3.4/dist-packages/django/forms/widgets.py" in get_context |
| 140 | 212. 'template_name': self.template_name, |
| 141 | |
| 142 | Exception Type: AttributeError at /xxxx/ |
| 143 | Exception Value: 'SplitArrayWidget' object has no attribute 'template_name' |
| 144 | |
| 145 | }}} |
| 146 | |
| 147 | I'm temporary fix this in my app by subclass django Widget and add template_name property |
| 148 | |
| 149 | {{{ |
| 150 | from django.contrib.postgres import forms as postgres_forms |
| 151 | |
| 152 | |
| 153 | class SplitArrayWidget(postgres_forms.SplitArrayWidget): |
| 154 | template_name = '' |
| 155 | {{{ |