10👍
✅
This is the culprit.
login = LoginModel(firstname, email)
When you initialize a model in this way, the arguments are passed to the fields in the order in which they (the fields) are defined. Now your first argument is firstname
and that will be assigned to the primary key field which is defined for your model automatically by Django and is considered to be the first.
Solution. Never initialize models like this. Always pass named parameters
login = LoginModel(firstname=firstname, email=email)
👤e4c5
Source:stackexchange.com