与两个外键一起连接两个桌子
我有三张桌子:
class Bank(models.Model):
...
class Deposit(models.Model):
...
class DepositProposal(models.Model):
percent = models.FloatField()
deposit = models.ForeignKey(Deposit)
bank = models.ForeignKey(Bank)
银行可以通过申请存款企业实例参加存款拍卖。如何过滤不参加存款的银行? 发现我应该使用两个左联接,但我没有使用posgtresql遇到它。
I have three tables:
class Bank(models.Model):
...
class Deposit(models.Model):
...
class DepositProposal(models.Model):
percent = models.FloatField()
deposit = models.ForeignKey(Deposit)
bank = models.ForeignKey(Bank)
Banks can participate in deposit auctions by applying the DepositProposal instance. How can I filter Banks that do not participate in Deposit?
Found that I should use two left join but I didn't come across it using PosgtreSQL.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想知道银行未参与的存款:
1-添加相关的_name存款和银行:
2-获取要检查的银行:
3-获取QuerySet:
edit: edit:
如果您想知道不参与特定存款的银行:
If you want to know the deposits in which a bank does not participate:
1- Add a related_name to deposit and bank:
2- Get the bank that you want to check:
3- Get the queryset:
EDIT:
If you want to know the banks that not participate on a specific deposit: