Closed LokkiDog closed 9 months ago
I'm not sure if this is the intended method but you can do this by overriding the URL used for the AJAX query. This can be done by supplying plugin_options
with a source
option:
# Generate new look URL for channel mychannelname
lookup_url = '{}?myparam={}'.format(
reverse('ajax_lookup', kwargs={'channel': 'mychannelname'}),
param_value
)
# Instruct a field to use it
AutoCompleteSelectField('mychannelname', plugin_options={'source': lookup_url})
and then, in your lookup:
@register('mychannelname')
class MyLookup(LookupChannel):
def get_query(self, q, request):
optional_param = request.GET.get('myparam', None)
if optional_param is not None:
# do some extra filtering
Thank you for answer! I'll try this:)