Use import csv option to populate the SQLFORM

21 views
Skip to first unread message

Sarbjit singh

unread,
Sep 30, 2013, 12:22:45 AM9/30/13
to web...@googlegroups.com
Hi,

I am having controller as :

@auth.requires_login()   
def add():
    form = SQLFORM(db.table)
    if form.process(formname='test').accepted:
        response.flash = 'Database Updated'
    elif form.errors:
        response.flash = 'Please fill all the required details'
    else:
        response.flash = 'Enter the required details'
    return dict(form=form)
   
In views, I am using custom widgets for the view of the add form.

My requirement is that, I want to give an option like "populate from csv" (just like import csv option in appadmin, which should just populate this form only and do not update the table).

Since I am new to web2py and have no experience using "export/import csv" options, will it be possible that I can use the existing import csv code and meet my requirement.

Any other pointers/options are welcome.

Reply all
Reply to author
Forward
0 new messages