Instead of the complexity of a single object with previous and next in it, I'd probably just stick 'previous_tests' and 'next_tests' in the context and use them directly. To go with that, I'd have the find_previous_and_next_testcases method return a tuple instead of the dict, and invoke it like this:
```python
(previous_tests, next_tests) = find_previous_and_next_testcases(testcase.id, request.GET.get("folder"))
```
Then you can stick previous_tests and next_tests in the context. It's OK as-is, but having simpler stuff in the template context is easier to work with and remember down the road.