我有以下型号:
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,它可以正常工作。知道错误来自何处?