[Fixed]-Django models.ForeignKey behavior

1👍

You can manually specify an column name for a model field with the db_column setting.

class PARTS(models.Model):
    partid = models.IntegerField(primary_key = True)
    productid = models.ForeignKey(PRODUCTS, related_name = 'parts', db_column='productid')
👤Tim

Leave a comment