Personal tools
You are here: Home Documentation Tutorials Grok Poller Tutorial Poll Results View

Poll Results View

Now all that is left for our simple poller application is the results view for the poll, which doesn't show us anything new, we just use the "string:" TALES expression just to show how it works.
This tutorial shows how to implement a simple polling application using Grok.
Page 13 of 14.

The view class in

class Results(grok.View):

and the template poll_templates/

<html xmlns=""
    <h1 tal:content="context/question">Poll question</h1>

      <li tal:repeat="option context/options">
        <span tal:define="votes python:context.get_response(option.label)"
              tal:replace="string:${option/label} has ${votes} votes.">

    <a href="" tal:attributes="href python: view.url(context.__parent__)">
      Back to polls

This completes the last user story, and the tutorial application is completed.