diff --git a/autocomplete/shortcuts.py b/autocomplete/shortcuts.py index 70e71ac..18c1b61 100644 --- a/autocomplete/shortcuts.py +++ b/autocomplete/shortcuts.py @@ -55,7 +55,10 @@ def get_items_from_keys(cls, keys, context): queryset = cls.get_queryset() results = queryset.filter(id__in=keys) - return [{"key": person.id, "label": person.name} for person in results] + return [ + {"key": record.id, "label": cls.get_label_for_record(record)} + for record in results + ] class QuerysetMappedIterable: