Django - makemigrations - No changes detected

前端 未结 30 1524
伪装坚强ぢ
伪装坚强ぢ 2020-12-02 04:44

I was trying to create migrations within an existing app using the makemigrations command but it outputs \"No changes detected\".

Usually I create new apps using the

30条回答
  •  隐瞒了意图╮
    2020-12-02 05:34

    I had copied a table in from outside of django and the Meta class defaulted to "managed = false". For example:

    class Rssemailsubscription(models.Model):
        id = models.CharField(primary_key=True, max_length=36)
        ...
        area = models.FloatField('Area (Sq. KM)', null=True)
    
        class Meta:
            managed = False
            db_table = 'RSSEmailSubscription'
    

    By changing manged to True, makemigrations started picking up changes.

提交回复
热议问题