Django Migration Error: Column does not exist

后端 未结 15 2327
北恋
北恋 2020-12-10 10:25

Python 3, Django 1.8.5, Postgres

I have a model Sites that has been working fine. I recently tried to add a field, airport_code, and migrate the data.

15条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-10 10:51

    I too got same issue when i executed a cmd like python manage.py makemigrations app1. I resolved my issue by commenting the custom orms which is running in another app2 under views.

    Example:

    inside app1 models.py

    class ModelA(models.Model):
        subject = models.CharField(max_length=1)
        course = models.CharField(max_length=1)
    

    inside app2 view.py

    # obj = ModelA.object.all()
    # get_subjct = [s.subject for s in obj]
    

    So here i have commented above code and executed the makemigrations and migrate then uncommented.

    Working fine...

提交回复
热议问题