On Friday, August 28, 2015 at 9:57:41 AM UTC-4, Richard wrote:
>
> fixture = False
> if fixture and db(db.table.id > 0).count() == 0:
>     db.table.insert(...)
>

Or put the code in an action that requires admin permission to access.

Or use a script and run:

python web2py.py -S myapp -M -R populate_db.py

Anthony
 

>
> On Fri, Aug 28, 2015 at 9:53 AM, Carlos Cesar Caballero Díaz <
> [email protected]> wrote:
>
>> Hi, I need to add some users, and some fields to tables at the first time 
>> that my app runs, right now I ask for fields in the tables and if they are 
>> empty I put the values, but I don't like to query the tables in all 
>> requests for doing this. What do you recommend me?
>>
>> --
>> Este mensaje le ha llegado mediante el servicio de correo electronico que 
>> ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
>> Nacional de Salud. La persona que envia este correo asume el compromiso de 
>> usar el servicio a tales fines y cumplir con las regulaciones establecidas
>>
>> Infomed: http://www.sld.cu/
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- You received this message because you are subscribed to the Google 
>> Groups "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to