I have an application which is in BETA mode. The model of this app has some classes with an explicit primary_key. As a consequence Django use the fields and doesn't create an id automatically.
class Something(models.Model):
name = models.CharField(max_length=64, primary_key=True)
I think that it was a bad idea (see unicode error when saving an object in django admin) and I would like to move back and have an id for every class of my model.
class Something(models.Model):
name = models.CharField(max_length=64, db_index=True)
I've made the changes to my model (replace every primary_key=True by db_index=True) and I want to migrate the database with south.
Unfortunately, the migration fails with the following message:
ValueError: You cannot add a null=False column without a default value.
I am evaluating the different workarounds for this problem. Any suggestions?
Thanks for your help
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…