define crud ;-)

from gluon.tools import *
crud=Curd(globals(),test)

On Apr 25, 1:42 pm, kike <[email protected]> wrote:
> Thank for your rapid answer, your solution work good, but if I not
> defined crud how I do it the same
>
> On Apr 25, 2:12 pm, mdipierro <[email protected]> wrote:
>
> > assuming you have crud defined in model db.py
>
> > def index():
> >     form=crud.update(test.persons,request.args(0))
> >     persons=test(test.person.id>0).select(orderby=db.person.name)
> >     return dict(form=form,persons=persons)
>
> > {{extend 'layout.html'}}
> > {{=form}}
> > {{for p in persons:}}
> > <a href="{{=URL(r=request,args=p.id)}}">{{=p.name}}</a><br/>
> > {{pass}}
>
> > On Apr 25, 1:02 pm, kike <[email protected]> wrote:
>
> > > Hi, I not have lot of experience about python and web2py, I need
> > > create a form to search some information and I need the field in that
> > > form content the value from a database. for example:
>
> > > I have the following db:
>
> > > test=DAL('mysql://root:r...@localhost/test1',pool_size=20)
>
> > > test.define_table('persons',
> > >                  Field('name', length=128),
> > >                  Field('last_name', length=128),
> > >                  Field('email', 'email'))
>
> > > And my idea is create a form with a field Name and when the user click
> > > on it display all the name where are stored in persons.name, and when
> > > the user select a name and click in a submit button show in another
> > > page the result of that.
>
> > > I have tried some ideas but don't work, if something cant help whit
> > > some example code.
> > > Thank for the atention.
>
> > > --
> > > Subscription 
> > > settings:http://groups.google.com/group/web2py/subscribe?hl=en

Reply via email to