[英]Django Foreign Key limit_choice_to with model object filter
[英]limit_choice_to all objects of a particular model classe in a ForeignKey
例
class Base():
pass
class A(Base)
parent=models.Foreignkey("self", limit_choices_to=(all members of the B class)
class B(Base)
parent=models.Foreignkey("self", limit_choices_to=(all members of the A class)
仅获取特定类的对象的limit_choices_to的查询语法是什么?)
这项工作不是吗?
class Base(Model):
parent=models.Foreignkey("self")
class Meta:
abstract = True
class A(Base):
parent=models.Foreignkey("B")
class B(Base):
parent=models.Foreignkey("A")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.