I am building a project to place an order. When I run makemigrations command then it gives an error of
SystemCheckError: System check identified some issues and I have deleted the migration file from migrations
Traceback:
order.Order.price: (fields.E304) Reverse accessor for 'Order.price' clashes with reverse accessor for 'Order.product'.
HINT: Add or change a related_name argument to the definition for 'Order.price' or 'Order.product'.
order.Order.product: (fields.E304) Reverse accessor for 'Order.product' clashes with reverse accessor for
'Order.price'.
HINT: Add or change a related_name argument to the definition for 'Order.product' or 'Order.price'.
My models.py
is as follows:
class Order(models.Model):
company = models.ForeignKey(Company, on_delete=models.CASCADE)
product = models.ForeignKey(Product, on_delete=models.CASCADE)
price = models.ForeignKey(Product, on_delete=models.CASCADE)
def __str__(self):
return self.company + self.product + self.price
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…