使用 SQL 生成 ManyToManyField
我有两个模型
class A(models.Model):
m = models.CharField(max_length=128)
class B(models.Model):
s = models.CharField(max_length=128)
,现在我想向 A 添加一个 ManyToManyField:
class A(models.Model):
m = models.CharField(max_length=128)
n = models.ManyToManyField('B',related_name='b_s',null=True,blank=True)
表 a 和 b 已经存在。如何使用 SQL 添加第三个表?
谢谢!
I have two models
class A(models.Model):
m = models.CharField(max_length=128)
class B(models.Model):
s = models.CharField(max_length=128)
and now I want to add a ManyToManyField to A:
class A(models.Model):
m = models.CharField(max_length=128)
n = models.ManyToManyField('B',related_name='b_s',null=True,blank=True)
table a and b are already exist.How can I use SQL to add the third table?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 django-south
Use django-south