moved url building to template from python code