If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!


  • 0
    pydev  8 years ago

    Hi Derek,

    just tested it and it worked, thanks for sharing!

    Here is some code to fill the db:

    def fillData():
        if db(db.cars.id>0).count() == 0:
            db.cars.truncate()
            db.cars.insert(Make='Ford',Model='Ford Focus')
            db.cars.insert(Make='Ford',Model='Ford Focus')
            db.cars.insert(Make='Nissan',Model='Nissan Sentra')
            db.cars.insert(Make='Nissan',Model='Nissan Altima')
            db.cars.insert(Make='Chevrolet',Model='Chevrolet Corvette')
            db.cars.insert(Make='Chevrolet',Model='Chevrolet Camaro')

    Cheers!

    pd

Commented on:

This is my attempt at showing how to do cascading dropdowns in the most basic way possible with Web2py.

Hosting graciously provided by:
Python Anywhere