Niladry Kar
Niladry Kar

Reputation: 1203

SyntaxError: keyword can't be an expression in django

new_todo = Todo(text=request.POST['text'],instance.User=request.user)

SyntaxError: keyword can't be an expression

What exactly went wrong here?

I just want the user who created the todo his name should be automatically relfected to the database.....So, I have done this in my create view...

Upvotes: 0

Views: 313

Answers (1)

blue note
blue note

Reputation: 29099

You problem is instance.User=.... The left part (that's what keyword mean in this context) should be one of the variable names that ToDo constructor accepts.

Also, it's not django-specific, it's general python.

Upvotes: 2

Related Questions