[web2py] IS_IN_SET or write in

2019-08-05 Thread Yebach
Hello Is it possible to create a validator for form field that is a combination of IS_IN_SET and a user write in? The field is of type string. db.nalogi.n_company.requires = IS_IN_SET(['Canon', 'HP', 'Xerox', 'Lexmark', 'Brother', 'Konica/Minolta', 'Kyocera', 'Other'], zero=('Select')) Thank y

[web2py] Re: How can I insert image in HTML from database?

2019-08-05 Thread Константин Комков
*Val K*, it is my table.py file: db.define_table( 'recipes', Field('NAME',length=512), Field('IMAGE','upload'), migrate=False ) It's code in my default.py file: row = db().select(db.recipes.IMAGE).first() image = str(dir(row)) >>> ['IMAGE', '__bool__', '__call__', '__class__', '__c

[web2py] Re: How can I insert image in HTML from database?

2019-08-05 Thread Val K
Set field type to 'upload' as Ramos suggests and in your first example it should be row.IMAGE instead of row.file -- 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 Issue

[web2py] Re: How can I insert image in HTML from database?

2019-08-05 Thread Dave S
On Saturday, August 3, 2019 at 7:57:15 AM UTC-7, Константин Комков wrote: > > Dave, I don't understand what means that string: > blob = db[somethingsomething].[copyblobltotmpfile] > Is your example only for '.jpeg' files or for another expansions too? > > I think you figured out the important st

[web2py] Re: How can I insert image in HTML from database?

2019-08-05 Thread Константин Комков
Hello! I can get image like that: import codecs base64_data = codecs.encode(row.recipes.IMAGE.read(), 'base64') base64_text = codecs.decode(base64_data, 'ascii') image = '' % base64_text Thank all! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2

Re: [web2py] Re: How to add vertical Scroll bar to the table in SQLGORM.grid

2019-08-05 Thread Christian Varas
+1, datatables is your friend Cheers El lun., 5 de ago. de 2019 22:27, Jim S escribió: > I'd look at implementing datatables.net to do that. > > https://datatables.net/ > > -Jim > > On Saturday, August 3, 2019 at 9:22:26 PM UTC-5, Ryan wrote: >> >> Hi all, instead of having multiple page of tab

[web2py] Re: How to add vertical Scroll bar to the table in SQLGORM.grid

2019-08-05 Thread Jim S
I'd look at implementing datatables.net to do that. https://datatables.net/ -Jim On Saturday, August 3, 2019 at 9:22:26 PM UTC-5, Ryan wrote: > > Hi all, instead of having multiple page of table, i would like to have 1 > table with vertical scroll bar in SQLFORM.grid so that the user can view

[web2py] Re: How to add vertical Scroll bar to the table in SQLGORM.grid

2019-08-05 Thread Dave S
On Saturday, August 3, 2019 at 7:22:26 PM UTC-7, Ryan wrote: > > Hi all, instead of having multiple page of table, i would like to have 1 > table with vertical scroll bar in SQLFORM.grid so that the user can view > all by scrolling up and down instead of go to multiple pages 1 2 3 > Thanks > >

Re: [web2py] Como retornar apenas um item apartir de uma busca no campo usando web2py

2019-08-05 Thread Christian Varas
Hi, why doesn't work good with first() ? if you do: db(db.table.xx==request.vars.xx).select().first() it will return just the first record, if it doesn't is because the record does not exist. other way to do this is with limitby: db().select(db.person.ALL, limitby=(0, 2)): http://www.web2py.co

[web2py] Como retornar apenas um item apartir de uma busca no campo usando web2py

2019-08-05 Thread Kimus
Ola , estou tentando fazer uma busca no banco usando db(db.table.id == request.vars.id).select() só que esse select retorna uma lista/rows dai queria saber como retornar apenas um item, ja tentei usar o .firts() mas não ta funcionando direito alguem teria alguma ideia -- Resources: - http://

[web2py] Re: ASSIGNJS Decimals

2019-08-05 Thread villas
Here is an example. I think this is a problem: >>> from gluon.serializers import json >>> json(decimal.Decimal(123.456)) '"123.45600030695446184836328029632568359375"' I think this is what a user would intend: >>> json(float(decimal.Decimal(123.456))) '123.456' *Suggestion:* In *gluon