Move functionality to django templates