In my project I have User
model from standard auth
Django model and the Todo
model. User can have many Todo.
When signed in user c
You need to use the form_valid method instead of get_initial
. Something like this:
def form_valid(self, form):
form.instance.user = self.request.user
return super(TodoView, self).form_valid(form)
I have never used get_initial
, but I guess it doesn't do anything because you don't include the user
field. That wouldn't be useful anyway, because you don't want the user to be able to change the value.