我有以下模型:
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,它工作正常。知道错误来自哪里吗?