[Answered ]-Django Migrate : TypeError: int() argument must be a string or a number, not 'User'

2👍

Solved the issue. This has been a bug in code.Django under ticket #23454
https://code.djangoproject.com/ticket/23454

But this bug has been closed due to insufficient information.

I created a new app and replaced the files with the older one and makemigrations as well as migrate ran successfully.

I think this issue arises if we try to change the Django Auth system after first migrate.

Thanks

0👍

What this means ?

Your function get_prep_value is returning this

return int(value) -> Type of value is User object

But it should be of type int or string(only if its a valid integer
enclosed in double quotes like “1” else an exception would be raised)

Since you have not shared that function, i would suggest the following things

  1. Check what you are passing into the value.
  2. Use type (value) before your return statement so you know what you are having inside the value variable.

Read here about the int() which might be confusing you here

python int( ) function

Leave a comment