the error is : ValueError: Cannot assign "UserSerializer(data=<User: d>)": "Question.user" must be a "User" instance.
tindus
oh, no problem, FunkyBob
your knowledge is worth your curmudgeonliness ;)
FunkyBob
tindus: as I said... rip all that shit out of your form.. and to it in the view's form_valid method
tindus
yes, mcspud, that was my point, that request isn't passed to modelForm. Not in scope, or however you'd describe it
FunkyBob
tindus: not needed in the form...
tindus
well, in another class, I have a required foreign key. I don't want to even show it to the user, so that's the way I figured out to not have the user have to pick himself from a list of users.
FunkyBob
...
"another class" ... ooh... all mysterious
mcspud
bed666: can you post your model code please
bed666
of what
question?
its very big
tindus
I made a form that doesn't have that item, and I stored the current user as a _user "loose" variable on the form object that is created. (the unbound form?)
mcspud
yeah
thats ok
tindus
the thingy class
FunkyBob
tindus: ... again... move your work into the view's form_valid method
tindus
members list all the movies, books, &c they have, and other people in their club(s) can peruse them and ask to borrow them
so, a member who adds a thingy doesn't need to select themselves from a pop-down list. The thingy should get created with the current user as the owner
ulhas joined the channel
Nizumzen joined the channel
dray3 joined the channel
Paradisee_
hello o/
d3prof3t
FunkyBob, hi
FunkyBob, which is the better approach to go; uWSGI+Nginx or Gunicorn+Nginx ?
FunkyBob
d3prof3t: depends
mcspud
tindus: You said above if a member creates a club, then they should be added to that club right
A modelform becomes "bound" when it relates exactly to a model instance
sagaragarwal94 has quit
So in the example I posted, it checks the database, if it can't find an existing model it creates one, and it returns a "bound" form, which means that it is displaying data
FunkyBob
tindus: to data
mcspud
Now, if it creates a model, there might be a whole bunch of default data that gets created with it
codeme joined the channel
tindus
why is it "insurance, created = ... "
i though that was how you assign two variables, but you gotta have two on the right
mcspud
The get_or_create method returns:
the new/existing model instance, and a boolean letting you know if it was created or not