Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

124
Views
ValueError: invalid literal for int() with base 10(Django)

error in cmd
Code

I tried to create a project where to manage a garage, but when I create the model in application"utiliser", I got this problem. Thanks!

9 months ago · Santiago Trujillo
1 answers
Answer question

0

In your code, you are trying to assign string client as the default value for your ForeignKey. ForeignKeys are represented as integers and that is why you get this error. You can assign id value of the foreign object (if exists), or use null=True which will make default NULL. If there is no data at all in this object, then remove default value, migrations and flush database, then you will get not-nullable ForeignKey field.

9 months ago · Santiago Trujillo Report
Answer question
Find remote jobs