[Django]-Django Error – ValueError: Field 'id' expected a number but got 'company'

3πŸ‘

βœ…

The option default='company' in Client, Leads and CallReport must be the error, make sure to remove it and then run the following commands:

python manange.py makemigrations

And after that run the following:

python manage.py migrate

When you define a relationship in django models, you can not add a type string in a relationship that is pointing to another model.

πŸ‘€allexiusw

0πŸ‘

"A ForeignKey contains the primary key of the target table. If the primary key of that table relating to the company value is an integer, then your default value must be that integer", not that string

then, Remember to delete the database, and the migrations inside the migrations folder, and Then

python manange.py makemigrations

Run the following:

python manage.py migrate

This should resolve your issue.

πŸ‘€barna

Leave a comment