Suppose I have a field f in my model defined as follows as a foreign key:
f = models.ForeignKey(AnotherModel)
When Django syncs database, the filed created in db will be called f_id
, automatically suffixed with '_id'.
The problem is I want this field in db named exactly as what I defined in model, f
in this case. How can I achieve that?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…