I have two models `model_a` and `model_b`, where their tables look something like this...
Table `a` looks something like this -- first row is column names, both contain characters:
id | tractce | someString
2 | "0011900" | "Label here"
Table `b`:
id | tractFIPS
1 | "0011900"
Here's code from `models.py`:
class model_a(models.Model):
tractce = models.CharField(max_length=6)
someString = models.TextField()
class model_b(models.Model):
tractFIPS = models.CharField(max_length=6)
I want to convert `model_b` so that the `tractFIPS` field is a foreign key referencing `model_a`. Something like this I guess...
class model_b(models.Model):
tractFIPS_FK = models.ForeignKey(model_a)
And the table for `model_b` would look something like this in the end:
id | tractFIPS_FK_id
1 | 2
How do I convert `model_b`'s `tractFIPS` field to a foreign key with the correct values in them?