Django Models (1054, “Unknown column in 'field list'”)

后端 未结 13 1707
庸人自扰
庸人自扰 2020-12-08 13:18

No idea why this error is popping up. Here are the models I created -

from django.db import models
from django.contrib.auth.models import User

class Shows(m         


        
13条回答
  •  执念已碎
    2020-12-08 13:54

    As @inception said my tables schema had changed & running syncdb did not update already created tables.

    Apparently any changes to the models when updated through syncdb does not change (as in update/modify) the actual tables. So I dropped the relevant DB & ran syncdb on empty DB. Now it works fine. :)

    For others, SOUTH data migration tool for Django seems to be favorite option. It seems to provide options which django models & syncdb falls short on. Must check out...

    Update 29th Sept 2019: From Django 1.7 upwards, migrations are built into the core of Django. If you are running a previous lower version of Django, you can find the repository on BitBucket.

提交回复
热议问题