Hi,
   I'm a new TG user, and I have this situation:

   1) This Kid Template:
       ....
       <form action="#">

                <input type="text" id="sigla" size="02" value="$
{tipoImovel.sigla}" />
            <br/>

            <input type="text" id="descricao" size="50" value="$
{tipoImovel.description}" />
            <br/>
            <div style="text-align: center;margin:0px;padding:0px;">

                <input type="button" value="Insert"/>
                <input type="button" value="Delete"/>
                <input type="button" value="Save"/>
                <input type="submit" value="Refresh"/>
                <input type="button" value="Print"/>
                <input type="button" value="Search"/>

                </div>
       </form>
       <br/>
       <table>
           <th >Sigla</th>
           <th >Descricao</th>
           <tr py:for="TipoImovel in tipos">
                <td><a href="${tg.url('/editTipoImovel', sigla=TipoImovel.sigla 
)}"
Py:content="TipoImovel.sigla"></a></td>
                <td>${TipoImovel.description}</td>
           </tr>
     </table>

   2) A class in my Model:

   class TipoImovel(SQLObject):
       sigla = UnicodeCol(alternateID=True, length=02)
           description = UnicodeCol(length=50)

   3) This methods in my Controller

   class Root(controllers.RootController):
    @expose(template="senger.templates.principal")
    def index(self):
        return dict()

    @expose(template="senger.templates.formTipoImoveis")
    def tipoImovel(self):
        tipos = TipoImovel.select()
        tipoImovel= TipoImovel.get(1)
        #tipoImovel = TipoImovel.select(TipoImovel.q.sigla=="")
        return dict(tipoImovel=tipoImovel,tipos=tipos)

    @expose(template="senger.templates.formTipoImoveis")
    def editTipoImovel(self, sigla):
        tipoImovel = TipoImovel.bySigla(sigla)
        tipos = TipoImovel.select()
        return dict(tipoImovel=tipoImovel,tipos=tipos)

   Well,
       When I load the page, I call the method tipoImovel(self), but
always I have that to load the object tipoImovel(TipoImovel.get(1)),
because if I don't  make this , it give me an error because the input
fields need of a value.

   How to resolve this situation ?, How to load a empty tipoImovel
object or don't receive this error ? or what is the best solution or
design to my page ?
   In the truth, I want to make all the operations in the same page,
how to resolve this ?


--~--~---------~--~----~------------~-------~--~----~
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