#30570: Integrity errors in Django project with custom User model
-----------------------------------------+------------------------
Reporter: siriuslan | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 2.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
I am setting up a new django(version 2.2) project and want to use custom
user model. When I load fixtures data, it failed with error like below:
django.db.utils.IntegrityError: Problem installing fixtures: insert or
update on table "doctors_doctor" violates foreign key constraint
"doctors_doctor_user_ptr_id_ba968804_fk_doctors_user_id" DETAIL: Key
(user_ptr_id)=(1) is not present in table "doctors_user".
From django document -
https://docs.djangoproject.com/en/2.2/topics/auth/customizing/#using-a
-custom-user-model-when-starting-a-project I realized I did 'python
manage.py migrate' before changing AUTH_USER_MODEL in settings.py. So I
tried to delete all tables and redo 'python manage.py migrate', but it
still hit this problem.
I can see there is another ticket -
https://code.djangoproject.com/ticket/23297 complaining the same issue, I
follow the solution for it but not working. No idea why.
--
Ticket URL: <https://code.djangoproject.com/ticket/30570>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.a6e78db6c7c0e24562925ad60d285e59%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.