Just to go with my last comment, in here you'd be able to just say {% previous_tests %} instead of {% previous_and_next_testcases.previous %}. That way you wouldn't have to remember what items are in that dict.