@never_cache
def filterchain_all(request, app, model, field, foreign_key_app_name, foreign_key_model_name, foreign_key_field_name, value):
 model_class = get_model(app, model)
 keywords = get_keywords(field, value)
 limit_choices_to = get_limit_choices_to(foreign_key_app_name, foreign_key_model_name, foreign_key_field_name)
 queryset = get_queryset(model_class, limit_choices_to=limit_choices_to)
 filtered = list(do_filter(queryset, keywords))
 if (not getattr(model_class._meta, 'ordering', False)):
  sort_results(list(filtered))
 excluded = list(do_filter(queryset, keywords, exclude=True))
 if (not getattr(model_class._meta, 'ordering', False)):
  sort_results(list(excluded))
 empty_choice = {'value': '', 'display': '---------'}
 serialized_results = ((serialize_results(filtered) + [empty_choice]) + serialize_results(excluded))
 return JsonResponse(serialized_results, safe=False)

@ never_cache def filterchain_all ( request , app , model , field , foreign_key_app_name , foreign_key_model_name , foreign_key_field_name , value ) : model_class = get_model ( app , model ) keywords = get_keywords ( field , value ) limit_choices_to = get_limit_choices_to ( foreign_key_app_name , foreign_key_model_name , foreign_key_field_name ) queryset = get_queryset ( model_class , limit_choices_to = limit_choices_to ) filtered = list ( do_filter ( queryset , keywords ) ) if ( not getattr ( model_class . _meta , 'ordering' , False ) ) : sort_results ( list ( filtered ) ) excluded = list ( do_filter ( queryset , keywords , exclude = True ) ) if ( not getattr ( model_class . _meta , 'ordering' , False ) ) : sort_results ( list ( excluded ) ) empty_choice = { 'value' : '' , 'display' : '---------' } serialized_results = ( ( serialize_results ( filtered ) + [ empty_choice ] ) + serialize_results ( excluded ) ) return JsonResponse ( serialized_results , safe = False )
returns filtered results followed by excluded results below .