getting integrity error with django_auth_log due to foreign key constraints.

created a custom user model named customuser and getting integrity error as follow
452, ‘Cannot add or update a child row: a foreign key constraint fails (crm.django_admin_log, CONSTRAINT django_admin_log_user_id_c564eba6_fk_auth_user_id FOREIGN KEY (user_id) REFERENCES auth_user (id))’)

in my project , settings.py i have updated auth_user_model as follow
AUTH_USER_MODEL = ‘accounts.CustomUser’
but why it is referecing defualt auth_user_model ,

Welcome @98021Varundeep 1

Did you make this change after already starting your project?

If so, see Changing to a custom user model mid-project.

Briefly, the easiest solution in this situation is to drop your database and recreate it. (Fixing it can be done, but requires a set of manual steps that you may not feel comfortable doing.)

Hi , thanks for your response,

i have cloned this github project, there was a virtaul environment, but i have created my own , and then run commands for migrations. The project was running successfully for days but getting this error in last 2 days.

will try to drop database.