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.