django-eav2
django-eav2 copied to clipboard
'list' object does not have attribute 'strip' when storing attribute of type 'date'
Expected Behavior
Successful save
Actual Behavior
Traceback (most recent call last):
File ".../python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File ".../python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File ".../python3.10/site-packages/django/contrib/admin/options.py", line 683, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)
File ".../python3.10/site-packages/django/utils/decorators.py", line 133, in _wrapped_view
response = view_func(request, *args, **kwargs)
File ".../python3.10/site-packages/django/views/decorators/cache.py", line 62, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File ".../python3.10/site-packages/django/contrib/admin/sites.py", line 242, in inner
return view(request, *args, **kwargs)
File ".../python3.10/site-packages/django/contrib/admin/options.py", line 1888, in change_view
return self.changeform_view(request, object_id, form_url, extra_context)
File ".../python3.10/site-packages/django/utils/decorators.py", line 46, in _wrapper
return bound_method(*args, **kwargs)
File ".../python3.10/site-packages/django/utils/decorators.py", line 133, in _wrapped_view
response = view_func(request, *args, **kwargs)
File ".../python3.10/site-packages/django/contrib/admin/options.py", line 1745, in changeform_view
return self._changeform_view(request, object_id, form_url, extra_context)
File ".../python3.10/site-packages/django/contrib/admin/options.py", line 1791, in _changeform_view
form_validated = form.is_valid()
File ".../python3.10/site-packages/django/forms/forms.py", line 205, in is_valid
return self.is_bound and not self.errors
File ".../python3.10/site-packages/django/forms/forms.py", line 200, in errors
self.full_clean()
File ".../python3.10/site-packages/django/forms/forms.py", line 433, in full_clean
self._clean_fields()
File ".../python3.10/site-packages/django/forms/forms.py", line 445, in _clean_fields
value = field.clean(value)
File ".../python3.10/site-packages/django/forms/fields.py", line 198, in clean
value = self.to_python(value)
File ".../python3.10/site-packages/django/forms/fields.py", line 530, in to_python
result = parse_datetime(value.strip())
Exception Type: AttributeError at /admin/my_app/mymodel/1/change/
Exception Value: 'list' object has no attribute 'strip'
Steps to Reproduce
Add an attribute of "date" type to some model, fill the attribute and save the model
Your Environment
Include relevant details about the environment you experienced the bug in.
- Version used: 1.2.3
- Environment name and version (e.g. Django 4.0.8):
- Operating System and version: Linux
Hi @pikhovkin - Can you provide any more details and/or code that you're using? Looking at the tests, are you doing anything different, or can you create a test that replicates what you're seeing?
In the tests, here's the DATE attribute being created - are you doing it differently?
Here's the test that stores datetime values in the Attribute, along with saving the model successfully.
Hi, @Dresdn!
I use admin site to save an attribute of "date" type.
File ".../python3.10/site-packages/django/forms/fields.py", line 530, in to_python
result = parse_datetime(value.strip())
The value
contains ['2022-10-10', '08:55:05']