[web2py] Re: How to define constraints DAL Beginner

2020-07-21 Thread Dave S
On Tuesday, July 21, 2020 at 5:59:20 PM UTC-7, Ivan Luis wrote: > > db.define_table('jogador', > Field('nome', 'string'), > Field('posicao','string'), > Field('altura','double'), > Field('peso','double'), > Field('equipe') > ) > > db.define_table('equipe', > Field('nome', 'string') >

Re: [web2py] No module named error

2020-07-21 Thread AGRogers
I think I'm on the latest versions of web2py and python. And i have problems getting modules to recompile (not sure how related that is to this topic). I gave up and just put all my modules in the Models folder. That always works for me. I'm going to need to sort that out though at some point. But

[web2py] Re: How to prevent submitting form details that already exist as a record in the database

2020-07-21 Thread Dave S
On Tuesday, July 21, 2020 at 3:16:29 AM UTC-7, villas wrote: > > Your my_validator function iterates through the whole table. This is OK > when you have a few records, but very inefficient if you have > thousands/millions. Why not simply query the table? Something like this... > > def my_va

Re: [web2py] No module named error

2020-07-21 Thread Dave S
On Saturday, July 18, 2020 at 2:15:13 PM UTC-7, xgp.l...@gmail.com wrote: > > Hi, > > Im replicating the example from the book for better testing: > > ./modules/mytest.py > > from gluon import current > > def ip(): > return current.request.client > > ./controllers/test.py > > from applications.

[web2py] How to define constraints DAL Beginner

2020-07-21 Thread Ivan Luis
db.define_table('jogador', Field('nome', 'string'), Field('posicao','string'), Field('altura','double'), Field('peso','double'), Field('equipe') ) db.define_table('equipe', Field('nome', 'string') ) I'm trying do reference the field " Equipe " at Jogador with "Name" at Equipe but

[web2py] Multiple sockets

2020-07-21 Thread xgp.l...@gmail.com
Hi, Is there a way to specify socket name for DB connection? Actually is only possible to specify directory, but i have multiple sockets on a postgres 11 cluster setup. Ex: Cluster 1 postgres2://postgres:postgrespass@/dbname?unix_socket=/tmp/.s.PGSQL.5432 Cluster 2 postgres2://postgres:postgr

[web2py] [pydal] Connect to Heroku Database

2020-07-21 Thread Carlos Zenteno
Has anybody been able to connect to a Postgres database using stand alone Pydal? I know I have to pass the database credentials via the environment variable DATABASE_URL thru the heroku-cli like this: DATABASE_URL=$(heroku config:get DATABASE_URL -a books-proyecto1) MY-PROCESS but I don't know w

[web2py] Re: How to prevent submitting form details that already exist as a record in the database

2020-07-21 Thread mostwanted
Impressive outlook Villas, thank you. On Tuesday, July 21, 2020 at 12:16:29 PM UTC+2, villas wrote: > > Your my_validator function iterates through the whole table. This is OK > when you have a few records, but very inefficient if you have > thousands/millions. Why not simply query the table?

[web2py] Re: How to prevent submitting form details that already exist as a record in the database

2020-07-21 Thread villas
Your my_validator function iterates through the whole table. This is OK when you have a few records, but very inefficient if you have thousands/millions. Why not simply query the table? Something like this... def my_validator(form): if db((db.lecture.id == form.vars.id) & (db.lecture.lec