Django South 错误:AttributeError:'DateTimeField'对象没有属性'model'`

2024-01-29

因此,我尝试通过向其中添加两列来迁移表。 AstartDate and an endDate. Using south对于 Django,这应该是一个简单的迁移。我还有很多其他带有日期时间的表,但由于某种原因,我在这里得到并发出问题,但我没有看到它。

堆栈跟踪指出:

AttributeError: 'DateTimeField' object has no attribute 'model'

这是我要迁移的模型:

# Keep track of who has applied for a Job
class JobApply(models.Model):
    job = models.ForeignKey(Jobs)
    user = models.ForeignKey(User)
    # Keep track of the Developer accepted to do the work
    accepted_dev = models.IntegerField(null=False, blank=False, default=0)
    # If 1 (True) the User has applied to this job
    isApplied = models.BooleanField(default=0)
    startDate = models.DateTimeField()
    endDate = models.DateTimeField()

除以下所有字段startDate and endDate已经存在于数据库中。因此,为了给这些列提供默认值,我通过终端使用 datetime.date.now() 来保持一切正常。问题是南schemamigration工作得很好,但实际的迁移却很糟糕。

如果有人能看到这个错误,我的头发会很感激。 :P

EDIT


我必须升级我的版本south for django到版本0.8.4.

必须运行以下命令:

sudo easy_install -U South

或者,如果使用pip:

pip install South --upgrade

之后,我的迁移按预期进行。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Django South 错误:AttributeError:'DateTimeField'对象没有属性'model'` 的相关文章

随机推荐