Wednesday, October 31, 2018

Re: Can't Upload Image Field With Django 2.1

It looks like the width_field option on the model field isn't a string.

On Wednesday, October 31, 2018 at 10:28:42 AM UTC-4, Pacôme Avahouin wrote:
Hello Tim,

Thanks for answering.

Here is the complete traceback.
By the way when i commented out the 'upload_file' function still i'm getting the same error. 
I believe the origin might be somewhere else.



Environment:


Request Method: POST

Django Version: 2.1.2
Python Version: 3.7.0
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'bootstrap4',
 'accounts',
 'posts']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']



Traceback:

File "C:\Users\ATM\Anaconda3\envs\EmXp\lib\site-packages\django\core\handlers\exception.py" in inner
  34.             response = get_response(request)

File "C:\Users\ATM\Anaconda3\envs\EmXp\lib\site-packages\django\core\handlers\base.py" in _get_response
  126.                 response = self.process_exception_by_middleware(e, request)

File "C:\Users\ATM\Anaconda3\envs\EmXp\lib\site-packages\django\core\handlers\base.py" in _get_response
  124.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "C:\Users\ATM\Anaconda3\envs\EmXp\lib\site-packages\django\views\generic\base.py" in view
  68.             return self.dispatch(request, *args, **kwargs)

File "C:\Users\ATM\Anaconda3\envs\EmXp\lib\site-packages\django\utils\decorators.py" in _wrapper
  45.         return bound_method(*args, **kwargs)

File "C:\Users\ATM\Anaconda3\envs\EmXp\lib\site-packages\django\contrib\auth\decorators.py" in _wrapped_view
  21.                 return view_func(request, *args, **kwargs)

File "D:\ISMAEL\APPS\EMX\emlaxpress\accounts\views.py" in dispatch
  36.         return super().dispatch(*args, **kwargs)

File "C:\Users\ATM\Anaconda3\envs\EmXp\lib\site-packages\django\views\generic\base.py" in dispatch
  88.         return handler(request, *args, **kwargs)

File "C:\Users\ATM\Anaconda3\envs\EmXp\lib\site-packages\django\views\generic\edit.py" in post
  194.         return super().post(request, *args, **kwargs)

File "C:\Users\ATM\Anaconda3\envs\EmXp\lib\site-packages\django\views\generic\edit.py" in post
  141.         if form.is_valid():

File "C:\Users\ATM\Anaconda3\envs\EmXp\lib\site-packages\django\forms\forms.py" in is_valid
  185.         return self.is_bound and not self.errors

File "C:\Users\ATM\Anaconda3\envs\EmXp\lib\site-packages\django\forms\forms.py" in errors
  180.             self.full_clean()

File "C:\Users\ATM\Anaconda3\envs\EmXp\lib\site-packages\django\forms\forms.py" in full_clean
  383.         self._post_clean()

File "C:\Users\ATM\Anaconda3\envs\EmXp\lib\site-packages\django\forms\models.py" in _post_clean
  398.             self.instance = construct_instance(self, self.instance, opts.fields, opts.exclude)

File "C:\Users\ATM\Anaconda3\envs\EmXp\lib\site-packages\django\forms\models.py" in construct_instance
  63.         f.save_form_data(instance, cleaned_data[f.name])

File "C:\Users\ATM\Anaconda3\envs\EmXp\lib\site-packages\django\db\models\fields\files.py" in save_form_data
  317.             setattr(instance, self.name, data or '')

File "C:\Users\ATM\Anaconda3\envs\EmXp\lib\site-packages\django\utils\functional.py" in __setattr__
  244.             setattr(self._wrapped, name, value)

File "C:\Users\ATM\Anaconda3\envs\EmXp\lib\site-packages\django\db\models\fields\files.py" in __set__
  346.             self.field.update_dimension_fields(instance, force=True)

File "C:\Users\ATM\Anaconda3\envs\EmXp\lib\site-packages\django\db\models\fields\files.py" in update_dimension_fields
  434.             (self.width_field and not getattr(instance, self.width_field)) or

Exception Type: TypeError at /user/edit-profile/
Exception Value: getattr(): attribute name must be string
 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/01a9fa18-7c86-4ddc-bea7-0886da8f87ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment