Thank you everybody.
I defined my tables in db.py but made them able to be populated from 
index(). It worked. I'm not sure why tables entries inserted from index() 
is persistent but not tables defined from index(). I'm reading through the 
DAL again to see what I missed.
Thank you very much all.

Regards,
 Madu.

On Friday, April 27, 2012 11:06:47 AM UTC+9, Madu wrote:
>
>
> Hello,
>
> I'm new to web2py and to web frameworks in general and I am trying to 
> learn the MVC model and web2py by coding. 
> What I'm trying to do is to have a user create tables and entries in a DB 
> that I have defined in dv.py:
>
>> *TestDB = DAL("sqlite://storage.sqlite")*
>
>
> Now in index() I'm trying to do as follows:
>
>> *
>> ** def index():
>> *
>
> * form = FORM(INPUT(_name='name', requires=IS_NOT_EMPTY()),*
>
> * INPUT(_type='submit'))*
>
> * if form.process().accepted:*
>
> * TestDB().define_table(form.vars.name, Field('testField', unique=True))*
>
> * return dict(form=form)*
>
> * **return dict(form=form)*
>
>
> This works (i.e. no errors) but I cannot see the created entry in 
> appadmin. From an answer I got in StackOverflow it's because what I do in 
> index() is not persistent. 
> I'd like to know what is the proper way of achieving this.
>
>
> Thank you.
>
>
> Regards,
> Madu.
>

Reply via email to