27 : {% block object-tools %}
28 : {% if change %}{% if not is_popup %}
29 :
32 : {% url opts|admin_urlname:'history' original.pk|admin_urlquote as history_url %}
33 : {% trans "History" %}
34 :- {% trans "View on site" %} {% endif %}
30 : {% block object-tools-items %}
31 :
35 : {% if has_absolute_url %}
36 : {% endblock %}
37 :
38 : {% endif %}{% endif %}
39 : {% endblock %}
40 : <form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}" method="post" id="{{ opts.model_name }}_form" novalidate>{% csrf_token %}{% block form_top %}{% endblock %}
41 :
42 : {% if is_popup %}{% endif %}
43 : {% if to_field %}{% endif %}
Traceback:
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
39. response = get_response(request)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
217. response = self.process_exception_by_middleware(e, request)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
215. response = response.render()
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/response.py" in render
109. self.content = self.rendered_content
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/response.py" in rendered_content
86. content = template.render(context, self._request)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/backends/django.py" in render
66. return self.template.render(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/base.py" in render
208. return self._render(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/test/utils.py" in instrumented_test_render
94. return self.nodelist.render(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/base.py" in render
994. bit = node.render_annotated(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/base.py" in render_annotated
961. return self.render(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/loader_tags.py" in render
174. return compiled_parent._render(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/test/utils.py" in instrumented_test_render
94. return self.nodelist.render(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/base.py" in render
994. bit = node.render_annotated(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/base.py" in render_annotated
961. return self.render(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/loader_tags.py" in render
174. return compiled_parent._render(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/test/utils.py" in instrumented_test_render
94. return self.nodelist.render(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/base.py" in render
994. bit = node.render_annotated(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/base.py" in render_annotated
961. return self.render(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/loader_tags.py" in render
70. result = block.nodelist.render(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/base.py" in render
994. bit = node.render_annotated(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/base.py" in render_annotated
961. return self.render(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/loader_tags.py" in render
70. result = block.nodelist.render(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/base.py" in render
994. bit = node.render_annotated(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/base.py" in render_annotated
961. return self.render(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/defaulttags.py" in render
209. nodelist.append(node.render_annotated(context))
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/base.py" in render_annotated
961. return self.render(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/loader_tags.py" in render
210. return template.render(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/base.py" in render
210. return self._render(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/test/utils.py" in instrumented_test_render
94. return self.nodelist.render(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/base.py" in render
994. bit = node.render_annotated(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/base.py" in render_annotated
961. return self.render(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/defaulttags.py" in render
209. nodelist.append(node.render_annotated(context))
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/base.py" in render_annotated
961. return self.render(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/defaulttags.py" in render
209. nodelist.append(node.render_annotated(context))
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/base.py" in render_annotated
961. return self.render(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/defaulttags.py" in render
315. return nodelist.render(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/base.py" in render
994. bit = node.render_annotated(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/base.py" in render_annotated
961. return self.render(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/defaulttags.py" in render
315. return nodelist.render(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/base.py" in render
994. bit = node.render_annotated(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/base.py" in render_annotated
961. return self.render(context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/base.py" in render
1050. return render_value_in_context(output, context)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/template/base.py" in render_value_in_context
1028. value = force_text(value)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/utils/encoding.py" in force_text
76. s = six.text_type(s)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/utils/html.py" in
391. klass.str = lambda self: mark_safe(klass_str(self))
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/forms/boundfield.py" in str
43. return self.as_widget()
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/forms/boundfield.py" in as_widget
89. attrs = self.build_widget_attrs(attrs, widget)
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/forms/boundfield.py" in build_widget_attrs
238. if widget.use_required_attribute(self.initial) and self.field.required and self.form.use_required_attribute:
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/django/forms/widgets.py" in use_required_attribute
441. return super(ClearableFileInput, self).use_required_attribute(initial) and not initial
File "/Users/me/.virtualenvs/my-site/lib/python3.5/site-packages/cloudinary/init.py" in len
129. return len(self.public_id)
Exception Type: TypeError at /admin/actions/action/3/change/
Exception Value: object of type 'NoneType' has no len()
Today I installed the latest 1.5.0 release in my Django 1.10 project, but CloudinaryField doesn't seem to be working when blank=True:
image = CloudinaryField('image', blank=True)
I'm getting the following error when accessing the object in the admin:
object of type 'NoneType' has no len()
I believe the error is connected to the
from_db_value
andto_python
definitions in cloudinary/models.py. They are checkingif value is None
, but they should be checkingif not value
. CloudinaryField is a CharField type and the value of a blank CharField is an empty string, notNone
.I am able to fix the error with the above changes, which look like this:
The previous version of cloudinary implemented this correctly, so I'm not sure why this was changed in 1.5.0.
The text was updated successfully, but these errors were encountered: