Hi,
I have the table Well_linedata and it has a ForeignKey, so when I added the to_field
argument
the updating view doesn’t show the selected item value
class Well_linedata(models.Model):
WellID = models.ForeignKey(Wellinfo ,to_field='WellID', on_delete=models.CASCADE)
W_MFD = models.ForeignKey(Manifo_types , on_delete=models.CASCADE)
L_Diamtr = models.ForeignKey(Flow_Network ,to_field='Diameter', on_delete=models.CASCADE)
see this image.
so I deleted the to_field
from this and changed the values in the models.py.
class Well_linedata(models.Model):
WellID = models.ForeignKey(Wellinfo , on_delete=models.CASCADE)
W_MFD = models.ForeignKey(Manifo_types , on_delete=models.CASCADE)
L_Diamtr = models.ForeignKey(Flow_Network , on_delete=models.CASCADE)
the data was like this in the table and I changed it manually like this
So everything works well.
the problem is that I don’t want to change the model.py tables and change the other data manually in tables I have a lot of data.
thanks