Re: IntegrityError: null value in column "user_id" violates not-null constraint

2020-07-30 Thread Dinolin yp job
': user}* > *serializer = **UploadSerializer**(data=data)* > > > > > *if serializer.is_valid():serializer.save() > return Response(serializer.data, status=status.HTTP_201_CREATED) > return Response(serializer.errors, status=status.HT

Re: IntegrityError: null value in column "user_id" violates not-null constraint

2020-07-30 Thread Dinolin yp job
Do you have an UploadForm already in your forms.py? if yes, show me with > the view that handles. > > On Thu, Jul 30, 2020 at 11:59 AM Dinolin yp job > wrote: > >> >> >> It worked but user_id column in uploads_upload table is empty. How to >> solve this issue? &g

Re: IntegrityError: null value in column "user_id" violates not-null constraint

2020-07-30 Thread Dinolin yp job
del.py, the User foreign key > does not have a null=True, and blank=True. So you can't save a null value > for that user field. > > On Thu, Jul 30, 2020 at 10:52 AM Dinolin yp job > wrote: > >> I'm trying to save image in postgres database. I have upload model

Re: IntegrityError: null value in column "user_id" violates not-null constraint

2020-07-30 Thread Dinolin yp job
y, the User foreign key > does not have a null=True, and blank=True. So you can't save a null value > for that user field. > > On Thu, Jul 30, 2020 at 10:52 AM Dinolin yp job > wrote: > >> I'm trying to save image in postgres database. I have upload model whic

IntegrityError: null value in column "user_id" violates not-null constraint

2020-07-30 Thread Dinolin yp job
I'm trying to save image in postgres database. I have upload model which has a foreign key reference to the extended custom user model. But it shows the following error uploads/model.py from django.db import models from django.contrib.auth import get_user_model User = get_user_model() class U