Issue
I created a amount field in models.py, I run python manage.py makemigrations and python manage.py migrate It gave me error ValueError: Field 'amount' expected a number but got ''. then I removed this amount field line from my code and again did makemigrations and migrate command. now again it it showing same error. when I open Django admin page and select my model name which is Orderss . It gives me error that there is no filed name amount
class Orders(models.Model):
order_id = models.AutoField(primary_key = True)
items_json = models.CharField(max_length=5000)
name = models.CharField(max_length=20)
# amount = models.IntegerField(default=0)
email = models.CharField(max_length=20)
address = models.CharField(max_length=50)
city = models.CharField(max_length=20)
state = models.CharField(max_length=20)
zip_code = models.IntegerField(max_length=6)
phone = models.IntegerField(max_length=12, default="")
def __str__(self):
return self.name
Solution
Delete your migrations and delete you db.sqlite3 and then
python3 manage.py makemigrations
python3 manage.py migrate
hope it work
Answered By - samir
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.