2👍
✅
Did you try to_field
option?
You can do:
b = models.ForeignKey(B, to_field="other_id")
However, the catch is that field other_id
must satisfy unique=True
.
Source:stackexchange.com