2๐
โ
If the primary key of the related model is an int (id
s are int by default), the ForeignKey column is also an int.
What you can do now is to edit the generated migration file (yourapp/migrations/000x_auto_xyz.py
) and delete the part that tries to set the default value. For example, if your migration file looks like this:
class Migration(migrations.Migration):
dependencies = [
...
]
operations = [
migrations.CreateModel(
name='Application',
fields=[
...
('myforeignkey', models.ForeignKey(to='otherapp.OtherModel', default='t')),
],
...
]
then just remove the , default='t'
part and re-run manage.py migrate
.
๐คSelcuk
Source:stackexchange.com