6: Template Valves

< Previous Step Next Step >


Render functions, for each page, are the only functions that call the Django template rendering methods.


We import the WSGI's Django renderer as 'template' with the following additional line in our import section:

from google.appengine.ext.webapp import template

... and then call template rendering function from our specific page renderers:

def splash_page_render (template_values):
# to do: add data to template_values
path = os.path.join(os.path.dirname(__file__), 'splash_page.html')
return template.render(path, template_values)


def user_page_render (template_values): # to do: add data to template_values path = os.path.join(os.path.dirname(__file__), 'user_page.html') return template.render(path, template_values)
def admin_page_render (template_values): # to do: add data to template_values path = os.path.join(os.path.dirname(__file__), 'admin_page.html') return template.render(path, template_values)
def group_page_render (template_values): # to do: add data to template_values path = os.path.join(os.path.dirname(__file__), 'group_page.html') return template.render(path, template_values)

Comments