所以我试图通过向其添加两列来迁移表.A startDate和endDate.使用southDjango,这应该是一个简单的迁移.我还有大量其他带有dateTimes的表格,但由于某种原因,我在这里得到并发布,我没有看到它.
堆栈跟踪说明:
AttributeError: 'DateTimeField' object has no attribute 'model'
Run Code Online (Sandbox Code Playgroud)
这是我正在迁移的模型:
# 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()
Run Code Online (Sandbox Code Playgroud)
DB中除了startDate并且endDate已经存在的所有字段.因此,为了给这些列提供默认值,我通过终端使用datetime.date.now()来保持一切正方形.问题是,南方的schemamigration工作正常,但实际的迁移barfs.
如果有人能看到错误,我的头发会很感激.:P
编辑:包括Stacktrace: …