[Answer]-Error linking django to legacy database

1👍

I think pk is handled as a special case; you shouldn’t name your field pk. Try:

id = models.IntegerField(primary_key=True, db_column="pk")

The problem is that _set_pk_val, which is used as the setter for the pk property, just calls itself if the attribute name for the primary key, _meta.pk.attname, is ‘pk’

👤sk1p

Leave a comment