Django 1.7 - makemigrations not detecting changes

前端 未结 29 1324
忘了有多久
忘了有多久 2020-11-27 12:43

As the title says, I can\'t seem to get migrations working.

The app was originally under 1.6, so I understand that migrations won\'t be there initially, and indeed i

29条回答
  •  有刺的猬
    2020-11-27 13:12

    Just in case you have a specific field that does not get identified by makemigrations: check twice if you have a property with the same name.

    example:

    field = django.db.models.CharField(max_length=10, default = '', blank=True, null=True)
    
    # ... later
    
    @property
    def field(self):
        pass
    

    the property will "overwrite" the field definition so changes will not get identified by makemigrations

提交回复
热议问题