[web2py] Convert Mysql query with subquery to DAL.

2014-03-25 Thread brahama von
Hi guys, Trying to convert this select t.id, t.gp_pro_id, t.gp_historicdate from course t where t.gp_historicdate = (select MAX(a.gp_historicdate) from course a where a.id = t.id) Any help is appreciated. Thanks! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - h

[web2py] Re: Help with SQL Query without using executesql preferably :)

2014-03-14 Thread brahama von
te it. Thanks El lunes, 10 de marzo de 2014 18:21:51 UTC-3, Cliff Kachinske escribió: > > The DAL chapter of the online Web2py manual explains how to fetch the max > value, same as a SQL GROUP BY. > > On Monday, March 10, 2014 3:54:59 PM UTC-4, brahama von wrote: >> >> This i

[web2py] Help with SQL Query without using executesql preferably :)

2014-03-10 Thread brahama von
This is the result i get from a simple select like this: legacy_db(legacy_db.cursodado.gp_pro_id==course).select() cursodado.gp_id cursodado.gp_pro_id cursodado.gp_historicdate cursodado.gp_curso_id 10003600042014-01-27 16:02:10None 10003600042014-01-27 17:18:31None 10003600042014-01-27 17

[web2py] Foreign Key Constraint Failed in dbadmin

2014-03-04 Thread brahama von
Hi guys! Been looking for this in the mail list but i can't understand why this is happening. Here is the model. Very simple, just learning and practicing. Its a version with a few changes of the image blog :) db.define_table('uploads', Field('up_name','string',requires=IS_NOT_EMPTY()),

[web2py] Re: Show referenced records in form that only belong to author

2014-02-27 Thread brahama von
quires = IS_IN_DB(db(db.post.author == auth.user_id), > db.post,'%(summary)s') > > The IS_IN_DB validator takes a Set object as the first argument, which can > be used to filter the allowable records. > > Anthony > > On Wednesday, February 26, 2014 5:23:41 PM UTC-5, bra

[web2py] Show referenced records in form that only belong to author

2014-02-26 Thread brahama von
Hi guys! How is the approach to do this? Here's the model - db.define_table('uploads', Field('up_name','string',requires=IS_NOT_EMPTY()), Field('mainfile','upload'), Field('thumb','upload',writable=False,readable=False), Field('up_author',db.auth_user,requi

[web2py] Re: Allow NULL in form validator with reference Field

2014-02-23 Thread brahama von
ábado, 22 de febrero de 2014 21:31:45 UTC-3, brahama von escribió: > > Thanks Niphlod! Will try that. Yes. Mysql with INNODB. I am loading the > courses manually but wanted to do it via the web2py form... > > > El martes, 18 de febrero de 2014 17:24:25 UTC-3, Niphlod escribió: >

[web2py] Re: Allow NULL in form validator with reference Field

2014-02-22 Thread brahama von
. > As an alternative, you can > > Field('awc_pro_id', 'integer', requires=IS_EMPTY_OR(IS_IN_DB())) > > On Monday, February 17, 2014 7:21:14 PM UTC+1, brahama von wrote: >> >> Hi, >> >> dunno why my previous post didn't make it. H

[web2py] Allow NULL in form validator with reference Field

2014-02-17 Thread brahama von
Hi, dunno why my previous post didn't make it. Here it goes. part of my model legacy_db.define_table('courses', Field('awc_name','string'), Field('awc_version','string'), Field('awc_link','string'), Field('awc_pro_id',legacy_db.project, required=False, default=None), Field('a

[web2py] Form with related model can't validate NULL value

2014-02-14 Thread brahama von
Hi, First time i write to the list. Been googling around and couldn't find a solution that i understand. I am really new to python and web2py. I have this model legacy_db.define_table('courses', Field('name','string'), Field('version','string'), Field('link','string'), Field('pr