Let me spell it out:
If the error message complains about the user field
        And the code you provided is correct
                Then your database is out of sync with your model definition


On Thursday 25 May 2017 13:53:19 Ismail Sarenkapic wrote:
> Tnx ,
> I know that i can manually select the user, but i want it to be
> automatic-with current user to add the product
> 
> > > class Product(models.Model):
> > > seller = models.ForeignKey(settings.AUTH_USER_MODEL)
^^^^^^^^^ Here is the seller field

> > > 
> > > #user = models.OneToOneField(settings.AUTH_USER_MODEL)
^^^^^^^ There is no user field. form.instance.user = 'foo' does not translate 
to anything 
useful.
The FormUserNeededMixin sets Product.user, which simply adds an instance 
variable, that is 
not picked up by the ORM, because 'user' is not a field in Product.fields.

The error should actually be about a field called 'seller', but because it is 
not in the form, it is 
not passed to the ORM and the old table complains about the user field, as it 
is the one that it 
still has.

-- 
Melvyn Sopacua

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/2021711.abbbOG0kaK%40devstation.
For more options, visit https://groups.google.com/d/optout.

Reply via email to