Hi everyone, I'm trying to make an app where a user can create its own
tables bases in some attributes, I have this:
View:
{{extend 'layout.html'}}
<form enctype="multipart/form-data"
action="{{=URL()}}" method="post">
Project Name:
<input name="projname" />
<br />Number Of Fields:
<input name="numfields" />
<br />Name of Fields:
<input name="namfields" />
<br /><input type="submit" />
</form>
<h2>Submitted variables</h2>
{{=BEAUTIFY(request.vars)}}
Controller:
def config():
if request.vars:
proj_name = session.projname = request.vars.projname
num_fields= session.numfields= request.vars.numfields
nam_fields= session.namfields= request.vars.namfields
tblname = proj_name + "_custom"
response.flash = tblname
createtable(tblname)
return dict()
And in utils.py (inside models folder)
def createtable(tablename):
tbl = db.define_table(tablename,Field('a'))
But it doesn't work :(
The form works, I can get the variables by request.vars, but the table
is not created, how could I create dynamic tables??
If an user needs a table called "project1" with 2 fields "F1 and F2"
and another user needs more different fields and table name, how could
I make this??
Thanks!