'Django suffix ForeignKey field with _id
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?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
