我有一个User对象
class User(AbstractBaseUser, PermissionsMixin, Base):
username = models.CharField(db_index=True, null=False, unique=True, max_length=255)
mobile = PhoneNumberField(db_index=True, null=False, unique=True)
is_staff = models.BooleanField(default=False)
is_superuser = models.BooleanField(default=False)
is_active = models.BooleanField(default=False)
我有以下Connections对象
class Connections(Base):
owner = models.OneToOneField(User, on_delete=models.CASCADE, null=True)
friends = models.ManyToManyField(User, related_name='friend_set', symmetrical=True)
followers = models.ManyToManyField(User, related_name="follower_set", symmetrical=False)
followings = models.ManyToManyField(User, related_name="following_set", symmetrical=False)
运行以下行时,
sender = User.objects.get(id=kwargs.get('sender_id'))
receiver = User.objects.get(id=kwargs.get('receiver_id'))
sender_connections, created = Connections.objects.get_or_create(owner=sender)
sender_connections.friends.add(receiver)
出现以下错误,
django.db.utils.OperationalError: no such column: <appname>_connections_friends.connections_id
我不确定我在做什么错了吗?