As of some relations in the ERD such as OrderItem and Food where Food may be deleted, we need to set the OrderItem.food field a value.
The preferred way to handle these situations in the models is simply just to use the food name.
But there are few challenges:
Is it possible to set a string to a field that should be a foreignKey?
Can we access the parent model (in this example Food) to get it's name and set it to Order.food
As of some relations in the ERD such as
OrderItem
andFood
where Food may be deleted, we need to set theOrderItem.food
field a value. The preferred way to handle these situations in the models is simply just to use the food name.But there are few challenges:
Order.food