我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用django_filters.ModelChoiceFilter()。
def __init__(self, *args, **kwargs): self.campaigns = kwargs.pop('campaigns') self.base_filters['campaign'] = django_filters.ModelChoiceFilter(queryset=self.campaigns, widget=django_filters.widgets.LinkWidget, method='filter_campaign') super(InformationObjectFilterSet, self).__init__(*args, **kwargs)