Django模型和测试:无法安装自定义SQL

时间:2013-06-12 20:49:09

标签: django django-models django-testing

我有以下型号:

from django.db import models
from django.forms import ModelForm
from vehicle.models import Vehicle
from account.models import Wheelster

class Ride(models.Model): 
    [...]
    driver = models.OneToOneField(Wheelster, blank=True)
    driver_vehicle = models.OneToOneField(Vehicle, blank=True) 
    [...]

但是当我尝试运行我的Django测试时,我收到以下错误。

Failed to install custom SQL for ride.Ride model: column "driver" of relation "ride_ride" does not exist
LINE 1: ...RT INTO ride_ride (origin, destination, datetime, driver, dr...

如果我将字段类型更改为CharField,它可以正常工作。知道错误来自何处?

0 个答案:

没有答案