Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 将Django模型字段移动到导致错误迁移的子类的正确方法_Python_Django_Django Models - Fatal编程技术网

Python 将Django模型字段移动到导致错误迁移的子类的正确方法

Python 将Django模型字段移动到导致错误迁移的子类的正确方法,python,django,django-models,Python,Django,Django Models,我正试图在我的Django模型上实现表面上的noop。现在看起来像 class OrgParent(model.Model): name = models.CharField() organization = models.ForeignKey(...) order = models.IntegerField() class Meta: abstract = True unique_together = (('name', 'or

我正试图在我的Django模型上实现表面上的noop。现在看起来像

class OrgParent(model.Model):
    name = models.CharField()
    organization = models.ForeignKey(...)
    order = models.IntegerField()

    class Meta:
        abstract = True
        unique_together = (('name', 'order'),)
        ordering = ('order',)

class OrgChild(OrgParent)
    other_field = models.CharField()
我想把它压缩成一个模型:

class OrgChild(models.Model)
    other_field = models.CharField()
    name = models.CharField()
    organization = models.ForeignKey(...)
    order = models.IntegerField()

    class Meta:
        abstract = True
        unique_together = (('name', 'order'),)
        ordering = ('order',)
但是,当我在
manage.py makemigrations
上执行此Django(运行1.7,计划很快升级)时,它会创建一个自动迁移,实际上会删除我的整个表

  xxxx_auto_xxxxxxx_xxxxx.py:
    - Alter unique_together for organizationchild (0 constraint(s))
    - Remove field organization from organizationchild
    - Delete model OrganizationChild
我想这个新模型的数据库支持将以完全相同的方式工作,因此我实际上不需要迁移。有没有办法忽略迁移?我应该只签入迁移,但删除迁移中的操作吗?是否有首选的Django方法来管理此迁移