I have the following problem. I need the query_parameters to get the correct item in get_item. atm it does not look like if it is supported. So i implemented this workaround:
class CustomWidget(AutoComboboxSelectWidget):
def update_query_parameters(self, qs_dict):
self.lookup_class.custom_filter.update(qs_dict)
super(AutoComboboxSelect, self).update_query_parameters(qs_dict)
class ABCLookup(ModelLookup):
custom_filter = dict()
def get_item(self, value):
return self.get_queryset().filter(**self.custom_filter).get(number=value)
Hmm. get_item is used by the field's to_python method as well and the request isn't really available there. I'm not sure it can be that strictly enforced but maybe I'm forgetting something.
I have the following problem. I need the
query_parameters
to get the correct item inget_item
. atm it does not look like if it is supported. So i implemented this workaround:Works, but good idea? Any other solution?