I'm doing clean up on django code - my IDE can easily detect unused variables etc in Python code, but I haven't found a way to find unused template variables - it would be much easier to clean up the view code if I could find out what values in the context dictionary are not accessed by the templates.
Is there a tool for this?
EDIT: I am looking for an offline solution, a static code analysis tool or such. While the paranoid templates solution suggested below is better than nothing, it is not optimal because there are multiple {% if ... %} branches in templates and futhermore, would require testing all the views (in all use cases) in order to find all the unreferenced variables.