I have a one model Product which have field location and 1 another model name is Inventory movement in which product is foreign key.
inventory movement model
product_id=models.ForeignKey(Product)
from_location = models.CharField("from location",max_length=30)
to_location=models.CharField("Locatiion",max_length=30)
user=models.CharField("Supervised By",max_length=50)
remarks=models.CharField("Remarks",max_length=50)
Product model.
product_id = models.CharField(max_length=100, primary_key=True)
product_name=models.CharField("Product Name",max_length=50)
location=models.CharField("Location",max_length=30)
首先,数据存在于产品模型中,现在我希望如果用户想要更改产品位置,则按库存移动形式进行维护。 现在,当用户在库存中输入to_location字段时,也会覆盖product.location字段,我该怎么做?