Which web2py version was working ? What was the sql output? As you mentioned, replacing belongs with contains fixed the problem.
On Saturday, March 28, 2015 at 6:53:50 PM UTC+1, Leonardo Pires Felix wrote: > > Not working too on the version for testers, in this case using sqlite. > Example: > > db.define_table("business_day", > Field("description", notnull=True), > Field("week_days", "list:integer", notnull=True)) > > db.business_day.insert(description='first week january 2015', week_days=[3 > ,4]) > 1L > >>> print db(db.business_day.id>0).select() > business_day.id,business_day.description,business_day.week_days > 1,first week january 2015,|3|4| > > >>> db(db.business_day.week_days.belongs([3])).select() > <Rows (0)> > > >>> db(db.business_day.week_days.belongs([3]))._select() > "SELECT business_day.id, business_day.description, > business_day.week_days FROM business_day WHERE (business_day.week_days IN > ('|3|'));" > > > Em sábado, 28 de março de 2015 13:27:28 UTC-3, Massimo Di Pierro escreveu: >> >> Can you please try the "for testers" version on the web site? Can you >> provide a simpler example to reproduce the problem? >> >> On Saturday, 28 March 2015 10:43:56 UTC-5, Leonardo Pires Felix wrote: >>> >>> Hi, >>> I think on last update the belongs stoped working. >>> I've a table that is defined like this: >>> db.define_table("regra_entrada", >>> Field("descricao", notnull=True, represent=nome, >>> requires=[IS_NOT_EMPTY(), IS_UPPER()]), >>> Field("data_inicial", "date", widget=SQLFORM.widgets. >>> string.widget, represent=campo_date_dia_semana, >>> default=request.now.date() + datetime.timedelta( >>> days=1), notnull=True), >>> Field("data_final", "date", notnull=True, widget=SQLFORM >>> .widgets.string.widget, >>> represent=campo_date_dia_semana), >>> # Definido as delimitações abaixo >>> Field("modo", "integer", widget=SQLFORM.widgets.radio. >>> widget, notnull=True, >>> represent=lambda v, l: _dic_modo[v] if v is not >>> None else None, requires=IS_IN_SET(_dic_modo)), >>> Field("notificacao_sms", "boolean", notnull=True, >>> default=True), >>> Field("notificacao_email", "boolean", notnull=True, >>> default=True), >>> Field("turnos", "list:integer", represent=lambda l, v: ", >>> ".join([db.turno(i).sigla for i in l]), >>> requires=IS_IN_DB(db, db.turno, multiple=True, >>> label=db.turno._format))) >>> >>> Then, it's populated like this: >>> >>> print db(db.regra_entrada.id > 0).select() >>> regra_entrada.id,regra_entrada.descricao,regra_entrada.data_inicial, >>> regra_entrada.data_final,regra_entrada.modo,regra_entrada. >>> notificacao_sms,regra_entrada.notificacao_email,regra_entrada.turnos >>> 19,OUTRO TESTE,2015-03-25,2015-05-01,0,True,True,|2|3|1| >>> >>> The problem is, i'm pretty sure that belongs should be working on this >>> case, as i have already tested it on early versions. But now belongs not >>> work, this is the outpout for belongs of field "turnos" with "3"(that is on >>> the table, on the previous output): >>> >>> print db(db.regra_entrada.turnos.belongs([3])).select() >>> regra_entrada.id,regra_entrada.descricao,regra_entrada.data_inicial, >>> regra_entrada.data_final,regra_entrada.modo,regra_entrada. >>> notificacao_sms,regra_entrada.notificacao_email,regra_entrada.turnos >>> >>> >>> >>> Maybe something was changed on the version i'm using? Or some specific >>> change to the postgres DAL? >>> >>> >>> Web2py version: 2.9.12-stable+timestamp.2015.01.17.06.11.03 >>> Rocket 1.2.6, Python 2.7.9 >>> OS: Debian 8(wheezy) >>> Postgres: "PostgreSQL 9.4.1 on x86_64-unknown-linux-gnu, compiled by >>> gcc-4.9.real (Debian 4.9.2-10) 4.9.2, 64-bit" >>> >>> >>> -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.