le 05.09.2008 21:44 Sean DiZazzo a écrit:
> Hi all,
> class Root(controllers.RootController):
>     @expose(template="audiotic.templates.files")
>     def index(self):
>
>         files = model.Files.select(orderBy="date").reversed()
>         checkbox = widgets.CheckBox(name="pass_qc", default=False,
> help_text=None)
>
>         return dict(files=files, checkbox=checkbox)
>
>
> Template
> ~~~~~~~~~~~~~~~~~
> <body>
>         <table border="1">
>                 <th>File</th><th>Status</th><th>Last Updated</
> th><th>Error Code</th><th>Pass QC</th>
>                 <tr py:for="file in files">
>                 <td>${file.filename}</td>
>                 <td>${file.state}</td>
>                 <td>${file.date}</td>
>                 <td>${file.errno}</td>
>                 <div py:if="file.pass_qc == 0">
>                         <?python checkbox.default=True ?>
>                 </div>
>                 <td>${checkbox.display()}</td>
>                 </tr>
>         </table>
> </body>
> </html>
>
>   
You just need to pass the value you want to be displayed to the widget. 
So, something like :

Template
~~~~~~~~~~~~~~~~~
<body>
        <table border="1">
                <th>File</th><th>Status</th><th>Last Updated</
th><th>Error Code</th><th>Pass QC</th>
                <tr py:for="file in files">
                <td>${file.filename}</td>
                <td>${file.state}</td>
                <td>${file.date}</td>
                <td>${file.errno}</td>
                <td>${checkbox.display(value=file.pass_qc==0)}</td>
                </tr>
        </table>
</body>

should do it...


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to