Duplicate column name

后端 未结 7 1791
栀梦
栀梦 2021-02-05 15:22

I\'ve changed my models an then I tried to migrate them, but got this error:

python manage.py migrate
Operations to perform:
  Apply all migrations: admin, conte         


        
相关标签:
7条回答
  • 2021-02-05 16:18

    I'm going to assume that you have a previous migration in which you've already added the short_description_eng field. You could check this by looking through the previous migration files for the string 'short_description_eng'. If thats True, you can just delete the following from the 0002_auto_20160315_1544 migration file.

    migrations.AddField(
        model_name='words',
        name='short_description_eng',
        field=models.CharField(blank=True, default='', max_length=100, verbose_name='Условное обозначение Eng'),
    ),
    

    If that isn't the case then its possible you've got your database in a foobar'ed state and it may be worth deleting it (assuming this is a development database) and recreating it.

    0 讨论(0)
提交回复
热议问题