开发者

Django - Limit the entries in models.ForeignKey()

开发者 https://www.devze.com 2023-01-27 11:57 出处:网络
class UserCustomer(models.Model): user = models.ForeignKey(User)开发者_高级运维 customer = models.ForeignKey(CustomerProfile)
class UserCustomer(models.Model):
    user = models.ForeignKey(User)开发者_高级运维
    customer = models.ForeignKey(CustomerProfile)

In admin interface, while adding a new record, is it possible to restrict(remove) the 'user' in user drop down, if that user is already associated with any customer?


Does this answer your question?


How about this one? He goes through multiple examples including filtering ModelAdmin inlines (which I think is what you're after).

0

精彩评论

暂无评论...
验证码 换一张
取 消