Issue
I'm coding a web app with django and now I'm starting to handle users. I'm trying to do the easy part, just create a new user throught admin interface, but when I try to do it I get a error and I don't find any info about it.
I enter django admin, log in with superuser, go to users, add user. It only asks for: username and password. When I submit changes then I get a NOT NULL constraint failed, this:
NOT NULL constraint failed: auth_user.last_login
I revised django documentation, and there it says to create a user like this:
- from django.contrib.auth.models import User
- user = User.objects.create_user('john', '[email protected]', 'johnpassword')
So, I open a terminal, and do "./manage.py shell" "import django" "import User" and then I try this code, but fails too, it says:
NameError: name 'User' is not defined
Maybe I've changed something in the first part of the project? I've created models, templates, urls and used /static/ for references to files.
Thanks for your help!
Solution
last_login
field changed in django 1.8. Just run the migrations
python manage.py migrate
Answered By - kmmbvnr
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.