SS
будет исключение
items = queryset.filter(Q(path=path) | Q(path='*')).all()тогда вот так - получается только один запрос? а path у меня unique
if len(items) == 1:
return items[0]
if len(items) > 1:
return next(i for i in items if i.path == path)
return None