Add this after define_table

for t in TAGS:
... db.tag.insert(name = t)


run once and then comment / delete the lines.

On Thu, Feb 10, 2011 at 10:57 PM, Sascha Peilicke <[email protected]> wrote:

> Hi guys,
>
> I'd like to know how to best populate a table with a given set of default
> values. I could add them manually via the shell, but I'd like it to be done
> when the table is created. Let's consider the following table:
>
> db.define_table('tag',
>    Field('name'),
>    format='%(name)s')
>
> And assume I got some tags:
>
> TAGS = ['nice','great','awesome']
>
> So, how's the most appropriate way in getting those tags into the table?
> --
> Mit freundlichen Grüßen,
> Sascha Peilicke
> http://saschpe.wordpress.com
>

Reply via email to