jcugat / django-custom-user

Custom user model for Django with the same behaviour as the default User class but with email instead of username.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not working in Django 1.9

bcoover opened this issue · comments

I am trying to get this working fully in Django 1.9, but I'm having an issue...
The default setup works fine, but I need to extend your model. However, I follow your directions to the letter (literally copy and paste, including creating an app called "my_app"), but it gets an error on migrations that ultimately won't let is setup any of the auth tables... any ideas?

I wonder if related to changed referenced at: https://docs.djangoproject.com/en/1.9/releases/1.9/#django-contrib-auth

Here's the error:

File "/usr/local/lib/python3.4/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.4/site-packages/django/db/backends/mysql/base.py", line 112, in execute
return self.cursor.execute(query, args)
File "/usr/local/lib/python3.4/site-packages/MySQLdb/cursors.py", line 226, in execute
self.errorhandler(self, exc, value)
File "/usr/local/lib/python3.4/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorvalue
File "/usr/local/lib/python3.4/site-packages/MySQLdb/cursors.py", line 217, in execute
res = self._query(query)
File "/usr/local/lib/python3.4/site-packages/MySQLdb/cursors.py", line 378, in _query
rowcount = self._do_query(q)
File "/usr/local/lib/python3.4/site-packages/MySQLdb/cursors.py", line 341, in _do_query
db.query(q)
File "/usr/local/lib/python3.4/site-packages/MySQLdb/connections.py", line 280, in query
_mysql.connection.query(self, query)
_mysql_exceptions.IntegrityError: (1215, 'Cannot add foreign key constraint')

Nevermind, this was my mistake, I had a circular model referencing error that was causing this. I have successfully integrated this with Django 1.9 and it works great!