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
When i do update object with Ajax i get error for ImageField.
That is "FileExtensionValidator" from django who expects an object for validation but a unicode is given.
Thanks for replying
Full Traceback
Traceback (most recent call last):
File "/root/.virtualenvs/django-1.11/local/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/root/.virtualenvs/django-1.11/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/root/.virtualenvs/django-1.11/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/root/.virtualenvs/django-1.11/local/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/root/.virtualenvs/django-1.11/local/lib/python2.7/site-packages/django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
File "/root/.virtualenvs/django-1.11/local/lib/python2.7/site-packages/django/views/generic/base.py", line 88, in dispatch
return handler(request, *args, **kwargs)
File "/home/admin/development/hnj/company/views.py", line 67, in post
if self.request.is_ajax():
File "/root/.virtualenvs/django-1.11/local/lib/python2.7/site-packages/django/forms/forms.py", line 183, in is_valid
return self.is_bound and not self.errors
File "/root/.virtualenvs/django-1.11/local/lib/python2.7/site-packages/django/forms/forms.py", line 175, in errors
self.full_clean()
File "/root/.virtualenvs/django-1.11/local/lib/python2.7/site-packages/django/forms/forms.py", line 384, in full_clean
self._clean_fields()
File "/root/.virtualenvs/django-1.11/local/lib/python2.7/site-packages/django/forms/forms.py", line 400, in _clean_fields
value = field.clean(value, initial)
File "/root/.virtualenvs/django-1.11/local/lib/python2.7/site-packages/django/forms/fields.py", line 600, in clean
return super(FileField, self).clean(data)
File "/root/.virtualenvs/django-1.11/local/lib/python2.7/site-packages/django/forms/fields.py", line 162, in clean
self.run_validators(value)
File "/root/.virtualenvs/django-1.11/local/lib/python2.7/site-packages/django/forms/fields.py", line 145, in run_validators
v(value)
File "/root/.virtualenvs/django-1.11/local/lib/python2.7/site-packages/django/core/validators.py", line 476, in __call__
extension = os.path.splitext(value.name)[1][1:].lower()
AttributeError: 'unicode' object has no attribute 'name'
The text was updated successfully, but these errors were encountered:
nikolaysm
changed the title
Ajax Validation ImageField
Ajax Validation ImageField Possibly bug
Apr 6, 2018
nikolaysm
changed the title
Ajax Validation ImageField Possibly bug
Ajax Validation ImageField. Possibly bug?
Apr 6, 2018
Could be solved by adding below function in "DropFileWidget"
def value_from_datadict(self, data, files, name):
"""
Given a dictionary of data and this widget's name, return the value
of this widget or None if it's not provided.
"""
tmp = data.get(name)
if tmp and len(tmp) == 1:
tmp = tmp.get('current_file')
return tmp
Hello,
I am using django 1.11.
When i do update object with Ajax i get error for ImageField.
That is "FileExtensionValidator" from django who expects an object for validation but a unicode is given.
Thanks for replying
Full Traceback
The text was updated successfully, but these errors were encountered: