Re: Can't Upload Image Field With Django 2.1

2018-10-31 Thread Pacôme Avahouin
Yes you right Tim, i have misunderstood the purpose of height_field and width_field, i'm new in Django :) Gonna check more in the documentation and try a third-party app to resize images. Thanks a lot for the help. I appreciate. -- You received this message because you are subscribed to the

Re: Can't Upload Image Field With Django 2.1

2018-10-31 Thread Tim Graham
You've misunderstood the purpose of height_field and width_field. Please read the documentation: https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ImageField.height_field You need to use a third-party app to do image resizing. Check out

Re: Can't Upload Image Field With Django 2.1

2018-10-31 Thread Pacôme Avahouin
> > My model fields look like this: > > class CustomAbstractUser(AbstractBaseUser, PermissionsMixin): > """ > An abstract base class implementing a fully featured User model with > admin-compliant permissions. > > Email and password are required. Other fields are optional. >

Re: Can't Upload Image Field With Django 2.1

2018-10-31 Thread Tim Graham
height_field and width_field should be strings. What's the error and what does your model fields look like? On Wednesday, October 31, 2018 at 10:53:53 AM UTC-4, Pacôme Avahouin wrote: > > Tim you just saved me right now:) I have spent the all night trying to > figure it out. > Thanks a lot. >

Re: Can't Upload Image Field With Django 2.1

2018-10-31 Thread Pacôme Avahouin
Tim you just saved me right now:) I have spent the all night trying to figure it out. Thanks a lot. Now when i removed the width_field it works fine. But how to define height_field and width_field directly from the model? Cause when i put their values in quotes i got another error. -- You

Re: Can't Upload Image Field With Django 2.1

2018-10-31 Thread Tim Graham
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

Re: Can't Upload Image Field With Django 2.1

2018-10-31 Thread Pacôme Avahouin
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 Request URL:

Re: Can't Upload Image Field With Django 2.1

2018-10-31 Thread Tim Graham
It would be helpful to see the complete traceback. What you provided doesn't show where the exception originates. On Tuesday, October 30, 2018 at 10:38:38 PM UTC-4, Pacôme Avahouin wrote: > > Hello guys, > > I'm trying to upload user avatar (ImageField type) with my own custom user > model

Can't Upload Image Field With Django 2.1

2018-10-30 Thread Pacôme Avahouin
Hello guys, I'm trying to upload user avatar (ImageField type) with my own custom user model following the documentation like this: class MyUsersProfileView(UpdateView): # First try def upload_file(request): if request.method == 'POST': form =