开发者

Django - Limit the entries in models.ForeignKey()

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜