21.12.2022 Views

python_para_desenvolvedores_2ed

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

190 MVC

<py-include="header.html">

<table>

<tr>

<th></th>

<py-for="coluna in colunas">

<th><py-eval="coluna"></th>

</py-for>

<th></th>

<th></th>

</tr>

<py-for="i, campos in enumerate(rec.fetchall())">

<tr>

<th><py-eval="unicode(i + 1)"></th>

<py-for="coluna in colunas">

<td><py-eval="unicode(campos[coluna])"></td>

</py-for>

<td>

<a href="/mod?ident=<pyeval="unicode(campos['id'])">">modificar</a>

</td><td>

<a href="/rem?ident=<py-eval="unicode(campos['id'])">">remover</a>

</td>

</tr>

</py-for>

</table>

<br />

<form action="/add" method="post">

<input type="submit" value=" adicionar " />

</form>

<p>

<py-eval="msg">

</p>

<py-include="footer.html">

Modelo “add.html” (página de formulário para novos registros):

<py-include="header.html">

<form action="/?op=add" method="post">

<table>

<py-for="coluna in colunas">

<tr><td>

<py-eval="coluna">

</td><td>

<input type="text" size="30" name="<py-eval="coluna">" />

</td></tr>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!