Unnecessary check for an empty list:
```
In [8]: dirs = ['abc', 'def']
In [9]: [{'name': d} for d in dirs]
Out[9]: [{'name': 'abc'}, {'name': 'def'}]
In [10]: dirs = []
In [11]: [{'name': d} for d in dirs]
Out[11]: []
```

same in `def files_autocomplete(request, search_term):` method