I use: http://django-filter.readthedocs.org/en/latest/usage.html and I have a problem with this code:
class BasicFilter(django_filters.FilterSet): class Meta: model = MyModel fields = [] class SiteFilter(BasicFilter): site = django_filters.ModelMultipleChoiceFilter( queryset=Site.objects.all(), help_text='' ) def __init__(self, *args, **kwargs): print kwargs super(BrowserFilter, self).__init__(*args, **kwargs) class Meta(ReportFilter.Meta): fields = ['site']
And when I use this:
site_filter = SiteFilter(user='test')
I have:
init () received an unexpected keyword argument to 'user'
I agree with @Ennest Ten. Seems like the first thing you need to try is change
super(BrowserFilter, self).__init__(*args, **kwargs)
to
super(SiteFilter, self).__init__(*args, **kwargs)
Source: https://habr.com/ru/post/1612595/More articles:SQLSTATE [HY000] [2002] php_network_getaddresses: getaddrinfo failed: nodename или servname предоставлено или неизвестно - phpSciPy interpolation of a large matrix - pythonIs this error constructor a bad idea? - c ++"Expected resource of interpolator error like [ResourceType]" and "Unable to resolve character" when creating a signed APK - androidRegex Запомните все матчи перед заменой - regexSitecore: the call is ambiguous between the following methods or properties: "Sitecore.Data.ID.operator! = (Sitecore.Data.ID, Sitecore.Data.ID)" - sitecoreSearch for a specific word in a text file and display a string on it - c #List of DLLs loaded by a specific process by its name - c #How to filter a WMI search by what I consider a nested property? - c #How to deploy yii2 using a web root other than / web - phpAll Articles