I want to import from a csv file, but I want to use the imported data in
only one of my database tables, not all of them, which is how I have seen
the examples online. Here is my code, which does not work:
Model
-------------------
db.define_table(
'upload',
Field('name'),
Field('email'))
db.upload.name.requires = IS_NOT_EMPTY()
db.upload.email.requires = [IS_EMAIL, IS_NOT_IN_DB(db, 'upload.email')]
Controller
----------------------
def upload():
db.upload.import_from_csv_file('nameTest.csv')
records =
SQLTABLE(db().select(db.upload.ALL),headers='fieldname:capitalize')
return dict(records=records)
View
------------------
{{extend 'layout.html'}}
<h2>Current data</h2>
{{=records}}
I know its basic, but I am just working on getting the feel for things
before I do a bigger project.