[web2py] hidden field on SQLForm

2024-06-20 Thread Diego Tostes
Hi,

is there a way to make a field hidden on SQLForm?

@auth.requires_login()
def ct_data_sharing():
trial_id = int(request.vars["trial_id"])

db.ct_data_sharing.trial_id.default = trial_id

query = (db.ct_data_sharing.id > 0 and db.ct_data_sharing.trial_id ==
trial_id)


form = SQLFORM.grid(query=query,
links_in_grid=True,
#field_id=db.rifas.id,
csv=False,
user_signature=False,
ignore_rw=True,
#fields=fields,
#headers=headers,
#orderby=default_sort_order,
create=True,
deletable=True,
editable=True,
details=False,
#fields=fields_list,
maxtextlength=70,paginate=40)


return {"form": form}


I want to make th trial_id field hidden and with a default value equal
trial_id

Is it possible?

rgds

diego

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAGx9uxR%2BQUczEPibVPGtJvG_kWXsHePDfOHdzcAoOPsPC9PAkw%40mail.gmail.com.


[web2py] Re: Setting hidden fields with custom SQLFORMs

2021-09-10 Thread Diego Tostes
Is it possible to use on SQLFORM.grid?

Em quarta-feira, 18 de março de 2015 às 16:11:44 UTC-3, pumplerod escreveu:

> I tried that.  It doesn't work either.  I've worked around my issue by 
> simply not using hidden fields at all, but rather populating the fields 
> after the form is submitted with the data I want recorded.
>
>
> On Tuesday, March 17, 2015 at 12:42:53 PM UTC-5, Dave S wrote:
>>
>>
>>
>> On Tuesday, March 17, 2015 at 10:38:18 AM UTC-7, pumplerod wrote:
>>>
>>> Is there something else which needs to be setup to accomplish this?  I 
>>> currently have...
>>>
>>> db.define_table('brands',
>>> Field('brand_name', type='string', requires=IS_NOT_EMPTY(),
>>>   label=T('Brand Name')),
>>> Field('active', type='boolean',
>>>   label=T('active')))
>>>
>>> form = SQLFORM(db.brands,hidden=dict(active=True))
>>>
>>>
>>> However when the form is displayed the field ('active') still shows up 
>>> visible.
>>>
>>>
>> The book doesn't have a detailed example at the referenced section 
>> (although details of what it is translated to are shown).
>>
>> Do you need quotes around the field name?  
>> hidden=dict("active"=True)
>> perhaps?
>>
>> /dps
>>
>>
>>
>>  
>>
>>>
>>> On Monday, July 29, 2013 at 6:23:30 PM UTC-5, lesssugar wrote:

 Take a look at the book: 
 http://web2py.com/books/default/chapter/29/07/forms-and-validators?search=hidden+fields#Hidden-fields

 You can try defining your hidden field with *hidden *attribute:

 SQLFORM(..., hidden=dict(hidden_field_name=hidden_field_value))

 It should work.

 On Monday, July 29, 2013 6:47:01 AM UTC+2, davedigerati wrote:
>
> I've succeeded in using a custom SQLFORM to restrict how many fields 
> of a table the user has to fill out, but now I am trying to set a hidden 
> field value (status) and struggling.
>
> I tried in the model to use:
> form = SQLFORM(db.games)
> form.vars.status = 'active'
>
> but the field never gets written to the db, I believe because it is 
> not one of the fields declared in html (below).
>
> I then tried through the html as 
> {{form.vars.status = 'active'}}
> but while it was in the Accepted form.vars, it doesn't show up in 
> request.vars and again, doesn't get written.
>
> So, okay, let's place it in the html as 
> {{request.vars.status = 'active'}}
> And now it gets into request.vars, but again is not written to the db.
>  
> I think I've sunk over my head on this one, and advice correcting my 
> approach above would be greatly appreciated.
> Or was this a bad path to start down and I should just use a separate 
> operation to write this field to the table after the record is created?
> Thanks,
> Dave
>
> html if it helps:
> {{=form.custom.begin}}
> {{form.custom.widget.tm_home["_placeholder"] = "Home Team Name"}}
> {{=form.custom.widget.tm_home}}
> {{request.vars.status = "active"}}   <---  tried variations of this 
> line & without it
> {{=form.custom.submit}}
> {{=form.custom.end}}
>


-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/fa7ca2c5-1eaa-4877-8577-b29a254d51bbn%40googlegroups.com.


[web2py] Column auth_user.id not found BUT the column exists.

2020-06-23 Thread Diego Tostes
I am getting this error:

Traceback (most recent call last):
  File "/home/rebec/web2py/gluon/restricted.py", line 227, in restricted
exec ccode in environment
  File "/home/rebec/web2py/applications/lavanderia/views/appadmin.html"
, line
169, in 
dict( ratio=ram['ratio'], hits=ram['hits'], misses=ram['misses']))}}
  File "/home/rebec/web2py/gluon/sqlhtml.py", line 3274, in __init__
"Column %s not found (SQLTABLE)" % colname)
KeyError: 'Column auth_user.id not found (SQLTABLE)'


But when i check the DB:

mysql> show columns in
auth_user;++--+--+-+-++|
Field  | Type | Null | Key | Default | Extra
   
|++--+--+-+-++|
id | int(11)  | NO   | PRI | NULL|
auto_increment || first_name | varchar(128) | YES  | |
NULL||| last_name  | varchar(128) | YES  |
| NULL||| email  | varchar(512) |
YES  | | NULL||| password   |
varchar(512) | YES  | | NULL|||
registration_key   | varchar(512) | YES  | | NULL|
   || reset_password_key | varchar(512) | YES  | | NULL|
 || registration_id| varchar(512) | YES  | | NULL|
   
|++--+--+-+-++8
rows in set (0.00 sec)

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAGx9uxQegYC%3Dqfg-X%3Diy5UM9Myczo6fQVW6KZhvQ49r71v4GLQ%40mail.gmail.com.


[web2py] Re: hidden field on CRUD

2019-02-26 Thread Diego Tostes
Done.

I did using the table definitions ...

Field('user_id', 'integer',writable=False
,readable=False,default=user_dic["user_id"])



Em ter, 26 de fev de 2019 09:34, Diego Tostes  escreveu:

> Hi,
>
> i have this controller:
>
> def cria_servico():
> crud.settings.create_next = URL('default', 'dashboard')
> form = crud.create(db.service)
>
>
> I have a field on db.service named user_id. I whant to force the form to
> fill this field with the auth_user.id of the user. How can i hidden this
> field? because on creation i can set the user id...
>
> crud.settings.create_onvalidation.servico.append(lambda
> form:form.vars.update(user_id=user_id))
>
>
> rgds
>
>
> Diego
>
>
>
>
>

-- 
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.


[web2py] hidden field on CRUD

2019-02-26 Thread Diego Tostes
Hi,

i have this controller:

def cria_servico():
crud.settings.create_next = URL('default', 'dashboard')
form = crud.create(db.service)


I have a field on db.service named user_id. I whant to force the form to
fill this field with the auth_user.id of the user. How can i hidden this
field? because on creation i can set the user id...

crud.settings.create_onvalidation.servico.append(lambda
form:form.vars.update(user_id=user_id))


rgds


Diego

-- 
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.


[web2py] Conditional fields

2019-02-23 Thread Diego Tostes
Hi,

Is it possible to use Conditional fields to show a filed field?

I want to fill the geolocation infos using a Zip code from a field.
rgds

Diego

-- 
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.


[web2py] Re: Create a drop-down menu from a database

2018-09-17 Thread Diego Tostes
Massimo,

may i use multiple fields on SQLFORM.factory?

may be a solution to create a form with the functionality of set a state 
and automatically fill a dropdown with all cities from selected state, set 
a city and automatically fill a dropdown with all zones from that selected 
cities... 

#my db.py

Adverts_Type = db.define_table('adverts_type', 
   Field('label', 'string'),
   Field('description', 'text'),
 )

States = db.define_table('states',
   Field('label', 'string'),
 )

Cities = db.define_table('cities',
   Field('state_id', db.states),
   Field('label', 'string'),
 )

Zones = db.define_table('zones', 
   Field('city_id', db.cities),
   Field('label', 'string'),
 )


Adverts = db.define_table('adverts',
   Field('owner_id', 'integer'),
   Field('type_id', adverts_type),
   Field('description', 'text'),
   Field('image', 'upload'),
   Field('city_id', 'integer'),
   Field('zone_id', 'integer'),
 )



Adverts.type_id.requires = IS_IN_DB(db(Adverts_Type), 'adverts_type.id', 
'%(label)s')
Cities.states_id.requires = IS_IN_DB(db(States), 'states.id', '%(label)s')
Zones.city_id.requires = IS_IN_DB(db(Cities), 'cities.id', '%(label)s')


Em quarta-feira, 1 de fevereiro de 2012 18:35:38 UTC-2, Massimo Di Pierro 
escreveu:
>
> Something like this? 
>
> db.define_table('cities', 
> Field('name'), 
> Field('state'), 
> format = '%(name)s' 
> ) 
>
>
> form = SQLFORM.factory(Field('choose_city','reference cities')) 
>
> On Feb 1, 2:25 pm, shartha  wrote: 
> > So the problem is two folds. I have defined a simple table as in: 
> > 
> > db = DAL("sqlite://storage.sqlite") 
> > 
> > db.define_table('cities', 
> > Field('name'), 
> > Field('state'), 
> > ) 
> > 
> > Now I'd like to have a drop-down list in my view that reads from the 
> > name filed of the database cities. How can I achieve this? Any help 
> > would be highly appreciated. 
> > 
> > Thanks! 
> > S.

-- 
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.


[web2py] conditional requirements

2018-09-16 Thread Diego Tostes
Hi,

i was reading about conditional fields (
http://web2py.com/books/default/chapter/29/07/forms-and-validators#Conditional-fields
)

and i have a question.

is it possible to do it as a table definition?

bellow are my table definition:

Adverts = db.define_table('adverts',
   Field('owner_id', 'integer'),
   Field('type_id', 'integer'),
   Field('description', 'text'),
   Field('image', 'upload'),
   Field('city_id', 'integer'),
   Field('zone_id', 'integer'),
 )

Adverts_Type = db.define_table('adverts_type',
   Field('label', 'string'),
   Field('description', 'text'),
 )

Cities = db.define_table('cities',
   Field('label', 'string'),
 )

Zones = db.define_table('zones',
   Field('city_id', 'integer'),
   Field('label', 'string'),
 )

Adverts.type_id.requires = IS_IN_DB(db(Adverts_Type), 'adverts_type.id',
'%(label)s')
Zones.city_id.requires = IS_IN_DB(db(Cities), 'cities.id', '%(label)s')


i need to create a form to fill the Adverts with zones per selected city.


Rgds

Diego

-- 
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.


[web2py] auto save feature

2018-07-15 Thread Diego Tostes
Hi,

i have a table with more than 60 fields. Is it possible to create a "auto
save" feature with web2py Built-in methods to allowing users to have data
saved while the process of filling the form?

rgds

Diego

-- 
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.


Re: [web2py] Re: error: invalid literal for long() with base 10: ''

2018-07-02 Thread Diego Tostes
The problem was at dB.clientes...

Solved. Thanks!!

Em seg, 2 de jul de 2018 16:20, Anthony  escreveu:

> Hard to say what's going on. Looks like it's getting an empty string from
> an ID field. What does the db.clientes definition look like?
>
> On Monday, July 2, 2018 at 7:38:27 AM UTC-4, Diego Tostes wrote:
>>
>> Hi,
>>
>> i have this table:
>>
>> def tempo_total_produto(produto_id):
>> try:
>> query = ((db.produto.id == produto_id))
>> result = db(query).select()
>> data_status = result[0]["data_criacao"]
>>
>> data_hoje = datetime.date.today()
>> retorno = abs((data_hoje - data_status).days)
>> except:
>> retorno = "sem data"
>> return retorno
>>
>>
>> Produto = db.define_table('produto',
>> Field('ficha_tecnica', 'upload', label=T("Ficha Tecnica")),
>> Field('descricao_produto', 'string', label=T("Descricao Produto")),
>> Field('foto_frente', 'upload', label=T("Foto Frente")),
>> Field('foto_costas', 'upload', label=T("Foto Costas")),
>> Field('foto_detalhe', 'upload', label=T("Foto Detalhe")),
>> Field('cliente_id', db.clientes, label=T("Cliente ID")),
>> Field('data_criacao', 'date', default=datetime.date.today,
>> label=T("Data Criacao Produto")),
>> Field('referencia', 'string', label=T("Referencia")),
>> Field('colecao', 'string', label=T("Colecao")),
>> Field('previsao_entrega', 'date', label=T("Previsão Entrega")),
>> Field('cronoanalise', 'integer', label=T("Cronoanálise")),
>> Field('custo', 'double', label=T("Custo Producao")),
>> Field('preco_venda', 'double', label=T("Preco Venda")),
>> Field('qtd_estimada', 'integer', label=T("Qtd Estimada")),
>> Field('lacrado', 'boolean', label=T("LACRADO")),
>> Field('finalizado', 'boolean', label=T("FINALIZADO")),
>> Field('cancelado', 'boolean', label=T("CANCELADO")),
>> Field.Virtual('tempo_total', lambda row: tempo_total_produto(
>> row.produto.id)),
>> )
>>
>>
>> #REQUIRES
>> Produto.cliente_id.requires = IS_IN_DB(db(Clientes), 'clientes.id',
>> '%(nome_cliente)s')
>>
>>
>> It is possible create and show a Produto using SQLFORM, but i am getting
>> a error when i am trying to edit.
>>
>>
>> Traceback
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>> 15.
>> 16.
>> 17.
>> 18.
>> 19.
>> 20.
>> 21.
>> 22.
>> 23.
>> 24.
>> 25.
>> 26.
>> 27.
>> 28.
>> 29.
>> 30.
>> 31.
>> 32.
>> 33.
>> 34.
>> 35.
>> 36.
>>
>> Traceback (most recent call last):
>>   File "/home/modasustentavel/web2py/gluon/restricted.py", line 227, in 
>> restricted
>> exec ccode in environment
>>   File 
>> "/home/modasustentavel/web2py/applications/modasustentavel/controllers/default.py"
>>  
>> <https://modasustentavel.pythonanywhere.com/admin/edit/modasustentavel/controllers/default.py>,
>>  line 677, in 
>>   File "/home/modasustentavel/web2py/gluon/globals.py", line 417, in 
>> self._caller = lambda f: f()
>>   File "/home/modasustentavel/web2py/gluon/tools.py", line 4241, in f
>> return action(*a, **b)
>>   File 
>> "/home/modasustentavel/web2py/applications/modasustentavel/controllers/default.py"
>>  
>> <https://modasustentavel.pythonanywhere.com/admin/edit/modasustentavel/controllers/default.py>,
>>  line 240, in cadastro_produto
>> maxtextlength=64,paginate=40)
>>   File "/home/modasustentavel/web2py/gluon/sqlhtml.py", line 2346, in grid
>> update_form = SQLFORM(table, record, **sqlformargs)
>>   File "/home/modasustentavel/web2py/gluon/sqlhtml.py", line 1295, in 
>> __init__
>> inp = self.widgets.options.widget(field, default)
>>   File &quo

[web2py] error: invalid literal for long() with base 10: ''

2018-07-02 Thread Diego Tostes
Hi,

i have this table:

def tempo_total_produto(produto_id):
try:
query = ((db.produto.id == produto_id))
result = db(query).select()
data_status = result[0]["data_criacao"]

data_hoje = datetime.date.today()
retorno = abs((data_hoje - data_status).days)
except:
retorno = "sem data"
return retorno


Produto = db.define_table('produto',
Field('ficha_tecnica', 'upload', label=T("Ficha Tecnica")),
Field('descricao_produto', 'string', label=T("Descricao Produto")),
Field('foto_frente', 'upload', label=T("Foto Frente")),
Field('foto_costas', 'upload', label=T("Foto Costas")),
Field('foto_detalhe', 'upload', label=T("Foto Detalhe")),
Field('cliente_id', db.clientes, label=T("Cliente ID")),
Field('data_criacao', 'date', default=datetime.date.today,
label=T("Data Criacao Produto")),
Field('referencia', 'string', label=T("Referencia")),
Field('colecao', 'string', label=T("Colecao")),
Field('previsao_entrega', 'date', label=T("Previsão Entrega")),
Field('cronoanalise', 'integer', label=T("Cronoanálise")),
Field('custo', 'double', label=T("Custo Producao")),
Field('preco_venda', 'double', label=T("Preco Venda")),
Field('qtd_estimada', 'integer', label=T("Qtd Estimada")),
Field('lacrado', 'boolean', label=T("LACRADO")),
Field('finalizado', 'boolean', label=T("FINALIZADO")),
Field('cancelado', 'boolean', label=T("CANCELADO")),
Field.Virtual('tempo_total', lambda row: tempo_total_produto(
row.produto.id)),
)


#REQUIRES
Produto.cliente_id.requires = IS_IN_DB(db(Clientes), 'clientes.id',
'%(nome_cliente)s')


It is possible create and show a Produto using SQLFORM, but i am getting a
error when i am trying to edit.


Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.

Traceback (most recent call last):
  File "/home/modasustentavel/web2py/gluon/restricted.py", line 227,
in restricted
exec ccode in environment
  File 
"/home/modasustentavel/web2py/applications/modasustentavel/controllers/default.py"
,
line 677, in 
  File "/home/modasustentavel/web2py/gluon/globals.py", line 417, in 
self._caller = lambda f: f()
  File "/home/modasustentavel/web2py/gluon/tools.py", line 4241, in f
return action(*a, **b)
  File 
"/home/modasustentavel/web2py/applications/modasustentavel/controllers/default.py"
,
line 240, in cadastro_produto
maxtextlength=64,paginate=40)
  File "/home/modasustentavel/web2py/gluon/sqlhtml.py", line 2346, in grid
update_form = SQLFORM(table, record, **sqlformargs)
  File "/home/modasustentavel/web2py/gluon/sqlhtml.py", line 1295, in __init__
inp = self.widgets.options.widget(field, default)
  File "/home/modasustentavel/web2py/gluon/sqlhtml.py", line 313, in widget
options = requires[0].options()
  File "/home/modasustentavel/web2py/gluon/validators.py", line 598, in options
self.build_set()
  File "/home/modasustentavel/web2py/gluon/validators.py", line 584,
in build_set
records = self.dbset(table).select(*fields, **dd)
  File "/home/modasustentavel/web2py/gluon/packages/dal/pydal/objects.py",
line 2020, in select
return adapter.select(self.query, fields, attributes)
  File "/home/modasustentavel/web2py/gluon/packages/dal/pydal/adapters/base.py",
line 1296, in select
return self._select_aux(sql,fields,attributes)
  File "/home/modasustentavel/web2py/gluon/packages/dal/pydal/adapters/base.py",
line 1277, in _select_aux
return processor(rows,fields,self._colnames,cacheable=cacheable)
  File "/home/modasustentavel/web2py/gluon/packages/dal/pydal/adapters/base.py",
line 1767, in parse
for row in rows]
  File "/home/modasustentavel/web2py/gluon/packages/dal/pydal/adapters/base.py",
line 1677, in _parse
value = self.parse_value(value, ft, blob_decode)
  File "/home/modasustentavel/web2py/gluon/packages/dal/pydal/adapters/base.py",
line 1527, in parse_value
return self.parsemap[key](value,field_type)
  File "/home/modasustentavel/web2py/gluon/packages/dal/pydal/adapters/base.py",
line 1622, in parse_id
return long(value)
ValueError: invalid literal for long() with base 10: ''




Any idea to fiz this ?


Rgds

Diego

-- 
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.


[web2py] form in a dialog box

2018-06-30 Thread Diego Tostes
Anyone already used this plugin or have any tips to create a link in a
SQLFORM that call a form in a dialog box?

http://www.web2pyslices.com/slice/show/1713/

Rgds

Diego

-- 
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.


Re: [web2py] Re: customize requires in DB

2018-06-27 Thread Diego Tostes
*Pedido.*ordem_servico_id*.requires = IS_IN_DB(Ordem_Servico),
'ordem_servico.id <http://ordem_servico.id/>',*
*lambda r: '%s - os: %s' %
(r.ordem_servico_id.produto_id.cliente_id.nome_cliente,*
  *
 r.ordem_servico_id.identificador_os))*

2018-06-27 12:25 GMT-03:00 Diego Tostes :

> Hi Anthony,
>
>
> i think that put the requires make my code more organized ... But it is a
> personal choice. I did changes in my tables and now i have:
>
>
> Clientes = db.define_table('clientes',
> Field('cnpj', 'string', label=T("CNPJ")),
> Field('nome_cliente', 'string', label=T("Cliente")),
> Field('email', 'string', label=T("E-mail")),
> Field('telefone', 'string', label=T("Telefone")),
> Field('responsavel_contato', 'string', label=T("Responsável")),
> )
>
> Produto = db.define_table('produto',
> Field('ficha_tecnica', 'upload', label=T("Ficha Tecnica")),
> Field('descricao_produto', 'string', label=T("Descricao Produto")),
> Field('cliente_id', db.clientes, label=T("Cliente ID")),
> )
>
> Ordem_Servico = db.define_table('ordem_servico',
> Field('identificador_os', 'string'),
> Field('produto_id', db.produto),
> Field('finalizado', "boolean"),
> )
>
> Pedido = db.define_table('pedido',
> Field('ordem_servico_id', db.ordem_servico),
> Field('tipo_pedido', "integer", label=T("tp"))
>
>
> *Pedido.produto_id.requires = IS_IN_DB(Ordem_Servico), 'ordem_servico.id
> <http://ordem_servico.id>',*
> *lambda r: '%s - os: %s' %
> (r.ordem_servico_id.produto_id.cliente_id.nome_cliente,*
> *
>  r.ordem_servico_id.identificador_os))*
>
> > is it possible to "navigate" like this?
>
> *r.ordem_servico_id.produto_id.cliente_id.nome_cliente*
>
> *to get the "nome_cliente" ?*
>
> Rgds
>
>
> Diego
>
> 2018-06-20 12:05 GMT-03:00 Diego Tostes :
>
>> Thanks Antony.
>>
>> I will code again with your tips.
>>
>> Rgds
>>
>> Diego
>>
>> 2018-06-20 11:56 GMT-03:00 Anthony :
>>
>>> Materia_Prima.pedido_id.requires = IS_IN_DB(db(Pedido), 'pedido.id',
>>> lambda r: '%s - referencia:
>>> %s' % (r.produto_id.cliente_nome,
>>>
>>>r.ordem_de_servico))
>>>
>>> Note, r.produto_id.cliente_nome is a recursive select (it will result in
>>> an additional database query for each item in the dropdown list).
>>>
>>> Also, why isn't pedido_id a reference field?
>>>
>>> Note, you can avoid manually specifying the IS_IN_DB validators if you
>>> instead make all of the relevant fields reference fields and then specify
>>> the "format" argument of the two referenced tables (i.e., the "label"
>>> arguments you are using in the IS_IN_DB validators can instead be specified
>>> as the "format" arguments in the definitions of the respective referenced
>>> tables). In that case, web2py will automatically define the IS_IN_DB
>>> validators for you.
>>>
>>> Anthony
>>>
>>>
>>> On Wednesday, June 20, 2018 at 10:40:18 AM UTC-4, Diego Tostes wrote:
>>>>
>>>> I have those tables:
>>>>
>>>> *Produto = db.define_table('produto',*
>>>> *Field('ficha_tecnica', 'upload', label=T("Ficha Tecnica")),*
>>>> *Field('cliente_id', 'integer', label=T("Cliente ID")),*
>>>> *Field('cliente_nome', 'string', label=T("Nome Cliente"))*
>>>> *)*
>>>>
>>>> *Pedido = db.define_table('pedido',*
>>>> *Field('produto_id', db.produto),*
>>>> *Field('ordem_de_servico', 'string', label=T("Ordem de Servico")),*
>>>> *Field('tipo_de_pedido', 'integer', label=T("Tipo de Pedido"))*
>>>> *)*
>>>>
>>>> *Materia_Prima = db.define_table('materia_prima',*
>>>> *Field('

Re: [web2py] Re: customize requires in DB

2018-06-27 Thread Diego Tostes
Hi Anthony,


i think that put the requires make my code more organized ... But it is a
personal choice. I did changes in my tables and now i have:


Clientes = db.define_table('clientes',
Field('cnpj', 'string', label=T("CNPJ")),
Field('nome_cliente', 'string', label=T("Cliente")),
Field('email', 'string', label=T("E-mail")),
Field('telefone', 'string', label=T("Telefone")),
Field('responsavel_contato', 'string', label=T("Responsável")),
)

Produto = db.define_table('produto',
Field('ficha_tecnica', 'upload', label=T("Ficha Tecnica")),
Field('descricao_produto', 'string', label=T("Descricao Produto")),
Field('cliente_id', db.clientes, label=T("Cliente ID")),
)

Ordem_Servico = db.define_table('ordem_servico',
Field('identificador_os', 'string'),
Field('produto_id', db.produto),
Field('finalizado', "boolean"),
)

Pedido = db.define_table('pedido',
Field('ordem_servico_id', db.ordem_servico),
Field('tipo_pedido', "integer", label=T("tp"))


*Pedido.produto_id.requires = IS_IN_DB(Ordem_Servico), 'ordem_servico.id
<http://ordem_servico.id>',*
*lambda r: '%s - os: %s' %
(r.ordem_servico_id.produto_id.cliente_id.nome_cliente,*
*
 r.ordem_servico_id.identificador_os))*

> is it possible to "navigate" like this?

*r.ordem_servico_id.produto_id.cliente_id.nome_cliente*

*to get the "nome_cliente" ?*

Rgds


Diego

2018-06-20 12:05 GMT-03:00 Diego Tostes :

> Thanks Antony.
>
> I will code again with your tips.
>
> Rgds
>
> Diego
>
> 2018-06-20 11:56 GMT-03:00 Anthony :
>
>> Materia_Prima.pedido_id.requires = IS_IN_DB(db(Pedido), 'pedido.id',
>> lambda r: '%s - referencia:
>> %s' % (r.produto_id.cliente_nome,
>>
>>  r.ordem_de_servico))
>>
>> Note, r.produto_id.cliente_nome is a recursive select (it will result in
>> an additional database query for each item in the dropdown list).
>>
>> Also, why isn't pedido_id a reference field?
>>
>> Note, you can avoid manually specifying the IS_IN_DB validators if you
>> instead make all of the relevant fields reference fields and then specify
>> the "format" argument of the two referenced tables (i.e., the "label"
>> arguments you are using in the IS_IN_DB validators can instead be specified
>> as the "format" arguments in the definitions of the respective referenced
>> tables). In that case, web2py will automatically define the IS_IN_DB
>> validators for you.
>>
>> Anthony
>>
>>
>> On Wednesday, June 20, 2018 at 10:40:18 AM UTC-4, Diego Tostes wrote:
>>>
>>> I have those tables:
>>>
>>> *Produto = db.define_table('produto',*
>>> *Field('ficha_tecnica', 'upload', label=T("Ficha Tecnica")),*
>>> *Field('cliente_id', 'integer', label=T("Cliente ID")),*
>>> *Field('cliente_nome', 'string', label=T("Nome Cliente"))*
>>> *)*
>>>
>>> *Pedido = db.define_table('pedido',*
>>> *Field('produto_id', db.produto),*
>>> *Field('ordem_de_servico', 'string', label=T("Ordem de Servico")),*
>>> *Field('tipo_de_pedido', 'integer', label=T("Tipo de Pedido"))*
>>> *)*
>>>
>>> *Materia_Prima = db.define_table('materia_prima',*
>>> *Field('pedido_id', 'integer', label=T("ID DO PEDIDO")),*
>>> *Field('data_recebimento', 'date', label=T("Data Recebimento")),*
>>> *)*
>>>
>>> *#requires*
>>> *Pedido.produto_id.requires = IS_IN_DB(db(Produto), 'produto.id
>>> <http://produto.id>', '%(cliente_nome)s - referencia: %(referencia)s')*
>>> *Materia_Prima.pedido_id.requires = IS_IN_DB(db(Pedido), 'pedido.id
>>> <http://pedido.id>', )*
>>>
>>>
>>> I need that the field Materia_Prima.pedido_id, persist the pedido_id but
>>> when i select in the dropdow of a SQLFORM the information is:
>>>
>>>
>>> *'%(cliente_nome)s - referencia: %(ordem_de_servico)s'  *
>>>
>>> but the field *cliente_nome* is a filed from *Produto*.
>>>
>>> is it Possible?
>>>
>>>
>>> Rgds
>>>
>>> Diego
>>>
>>>
>>> --
>> 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.
>>
>
>

-- 
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.


[web2py] data from more than one table on SQLFORM grid

2018-06-26 Thread Diego Tostes
HI,

I have those tables:


*Produto = db.define_table('produto',*
*Field('ficha_tecnica', 'upload', label=T("Ficha Tecnica")),*
*Field('descricao_produto', 'string', label=T("Descricao Produto")))*


*Ordem_servico = db.define_table('ordem_servico',*
*Field('identificador_os', 'string'),*
*Field('data_criacao', 'date"))*


*Pedido = db.define_table('pedido',*
*Field('produto_id', db.produto),*
*Field('ordem_de_servico', db.ordem_servico),*
*Field('tipo_pedido', "integer", label=T("tp")),*
*Field('tipo_producao', 'string', label=T("Tipo Producao")))*



Is it possible to generate a grid using SQLFORM that show in the header:


*descricao_produto | identificador_os | tipo_pedido | tipo_producao *


And allow me to create new "pedido" ?

Rgds

Diego

-- 
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.


Re: [web2py] Re: customize requires in DB

2018-06-20 Thread Diego Tostes
Thanks Antony.

I will code again with your tips.

Rgds

Diego

2018-06-20 11:56 GMT-03:00 Anthony :

> Materia_Prima.pedido_id.requires = IS_IN_DB(db(Pedido), 'pedido.id',
> lambda r: '%s - referencia:
> %s' % (r.produto_id.cliente_nome,
>
>  r.ordem_de_servico))
>
> Note, r.produto_id.cliente_nome is a recursive select (it will result in
> an additional database query for each item in the dropdown list).
>
> Also, why isn't pedido_id a reference field?
>
> Note, you can avoid manually specifying the IS_IN_DB validators if you
> instead make all of the relevant fields reference fields and then specify
> the "format" argument of the two referenced tables (i.e., the "label"
> arguments you are using in the IS_IN_DB validators can instead be specified
> as the "format" arguments in the definitions of the respective referenced
> tables). In that case, web2py will automatically define the IS_IN_DB
> validators for you.
>
> Anthony
>
>
> On Wednesday, June 20, 2018 at 10:40:18 AM UTC-4, Diego Tostes wrote:
>>
>> I have those tables:
>>
>> *Produto = db.define_table('produto',*
>> *Field('ficha_tecnica', 'upload', label=T("Ficha Tecnica")),*
>> *Field('cliente_id', 'integer', label=T("Cliente ID")),*
>> *Field('cliente_nome', 'string', label=T("Nome Cliente"))*
>> *)*
>>
>> *Pedido = db.define_table('pedido',*
>> *Field('produto_id', db.produto),*
>> *Field('ordem_de_servico', 'string', label=T("Ordem de Servico")),*
>> *Field('tipo_de_pedido', 'integer', label=T("Tipo de Pedido"))*
>> *)*
>>
>> *Materia_Prima = db.define_table('materia_prima',*
>> *Field('pedido_id', 'integer', label=T("ID DO PEDIDO")),*
>> *Field('data_recebimento', 'date', label=T("Data Recebimento")),*
>> *)*
>>
>> *#requires*
>> *Pedido.produto_id.requires = IS_IN_DB(db(Produto), 'produto.id
>> <http://produto.id>', '%(cliente_nome)s - referencia: %(referencia)s')*
>> *Materia_Prima.pedido_id.requires = IS_IN_DB(db(Pedido), 'pedido.id
>> <http://pedido.id>', )*
>>
>>
>> I need that the field Materia_Prima.pedido_id, persist the pedido_id but
>> when i select in the dropdow of a SQLFORM the information is:
>>
>>
>> *'%(cliente_nome)s - referencia: %(ordem_de_servico)s'  *
>>
>> but the field *cliente_nome* is a filed from *Produto*.
>>
>> is it Possible?
>>
>>
>> Rgds
>>
>> Diego
>>
>>
>> --
> 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.
>

-- 
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.


[web2py] customize requires in DB

2018-06-20 Thread Diego Tostes
I have those tables:

*Produto = db.define_table('produto',*
*Field('ficha_tecnica', 'upload', label=T("Ficha Tecnica")),*
*Field('cliente_id', 'integer', label=T("Cliente ID")),*
*Field('cliente_nome', 'string', label=T("Nome Cliente"))*
*)*

*Pedido = db.define_table('pedido',*
*Field('produto_id', db.produto),*
*Field('ordem_de_servico', 'string', label=T("Ordem de Servico")),*
*Field('tipo_de_pedido', 'integer', label=T("Tipo de Pedido"))*
*)*

*Materia_Prima = db.define_table('materia_prima',*
*Field('pedido_id', 'integer', label=T("ID DO PEDIDO")),*
*Field('data_recebimento', 'date', label=T("Data Recebimento")),*
*)*

*#requires*
*Pedido.produto_id.requires = IS_IN_DB(db(Produto), 'produto.id
', '%(cliente_nome)s - referencia: %(referencia)s')*
*Materia_Prima.pedido_id.requires = IS_IN_DB(db(Pedido), 'pedido.id
', )*


I need that the field Materia_Prima.pedido_id, persist the pedido_id but
when i select in the dropdow of a SQLFORM the information is:


*'%(cliente_nome)s - referencia: %(ordem_de_servico)s'  *

but the field *cliente_nome* is a filed from *Produto*.

is it Possible?


Rgds

Diego

-- 
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.


[web2py] IS_IN_DB and SQLFORM edition

2018-06-13 Thread Diego Tostes
Hi,


i have a table and i am using:

Show_Room.product_id.requires = IS_IN_DB(db(Product), 'product.ref',
'%(client_name)s - ref: %(ref)s')

When i am using SQLFORM to edit a line of my table, the already persisted
product_id is not selected and i have to select again. If i do not select
the product id again i am get the error:

Value not in database

How can i fix this to the SQLFORM mount a form with the already persisted
values filled?

Rgds

Diego

-- 
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.


[web2py] pre-populating SQLFORM

2018-06-11 Thread Diego Tostes
Hi,

I want to send informations to fill some fields in a SQLFORM.

I read this on web2py book:

http://web2py.com/books/default/chapter/29/07/forms-and-validators#Pre-populating-the-form


But i did not understood. Anybody has a example of this ?


def display_form():
   record = db.person(request.args(0)) or redirect(URL('index'))
   url = URL('download')
   link = URL('list_records', args='db')
   form = SQLFORM(db.person, record, deletable=True,
  upload=url, linkto=link)  *form.vars.name =
'fieldvalue'*   if form.process().accepted:
   response.flash = 'form accepted'
   elif form.errors:
   response.flash = 'form has errors'
   return dict(form=form)

is it correct?

rgds

Diego

-- 
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.


Re: [web2py] Re: trigger implementation

2018-06-11 Thread Diego Tostes
Thanks!!!

it works!!

2018-06-09 21:36 GMT-03:00 黄祥 :

> perhaps you can use callback (before_update or after_update)
> ref:
> http://web2py.com/books/default/chapter/29/06/the-
> database-abstraction-layer#callbacks-on-record-insert--delete-and-update
>
> best regards,
> stifan
>
> --
> 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.
>

-- 
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.


[web2py] trigger implementation

2018-06-09 Thread Diego Tostes
Hi,

is there a way to implement a trigger on web2py?

i need a way to persist informations in a table every time a specific
column in a specific table changes the value.

rgsd

Diego

-- 
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.


[web2py] custom header in QLFORM

2018-04-21 Thread Diego Tostes
Hi,

this is my code:

fields = (db.ensaios.codigo_registro,
  db.ensaios.patrocinador_primario,
  db.ensaios.contato_publico,
  db.ensaios.titulo_en,
  db.ensaios.trial_info
  )


headers = {'db.ensaios.codigo_registro': T('Register Code'),
   'db.ensaios.patrocinador_primario':T('Patrocinador
Primario'),
   'db.ensaios.contato_publico':T('Public Contact'),
   'db.ensaios.titulo_en':T('English title'),
   'db.ensaios.trial_info':T('trial information'),
   }


form = SQLFORM.grid(query=query_ensaios,
links_in_grid=True,
field_id=None,
csv=False,
user_signature=False,
ignore_rw=True,
fields=fields,
headers=headers,
orderby=default_sort_order,
create=False,
deletable=False,
editable=False,
details=False,
maxtextlength=64,
paginate=40)

But in my view a still with the header column with the columns names.

what is wrong?

Rgds,

Diego

-- 
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.


Re: [web2py] Re: direct upload in directory

2018-04-03 Thread Diego Tostes
thanks.

db(db.ensaios.codigo_registro == "novo ensaio").update(en_pdf=stream)

works for me!!

thanks again!

2018-04-03 7:09 GMT-03:00 Dave S :

> On Monday, April 2, 2018 at 12:50:38 PM UTC-7, Diego Tostes wrote:
>>
>> Hi,
>>
>> I already use this:
>>
>> stream = open("/teste_en.pdf", 'rb')
>> db.ensaios.insert(codigo_registro="novo ensaio",
>>   en_pdf=stream
>> )
>>
>>
> You're using this to read the file into the uploads table?  You haven't
> set "uploadfield=True" on your upload fields, so the model is expecting the
> file to be stored in the uploads directory, and a filename to be filled in
> as the field value.
>
>
>>
>> but I need to know if is a possible update a row with an upload.
>>
>>
> I would think so, but the most common usage seems to be just to make a new
> entry with every upload, with the form.process.accepted doing an insert,
> except if you've set the record parameter to SQLFORM().  See
> http://web2py.com/books/default/chapter/29/07/forms-
> and-validators#SQLFORM-and-insert-update-delete>
> (and a brief mention in the SQLFORM() signature a couple paragraphs above)/
>
> You may want to show us the controller code you are using if this doesn't
> answer your questions.
>
> /dps
>
>
>>
>> 2018-04-02 14:27 GMT-03:00 Diego Tostes :
>>
>>>
>>>
>>> 2018-04-02 13:22 GMT-03:00 Diego Tostes :
>>>
>>>> Hi,
>>>>
>>>>
>>>> i have a table in my model called ensaios:
>>>>
>>>> Ensaios = db.define_table('ensaios',
>>>> Field('codigo_registro', 'string'),
>>>> Field('url', 'string'),
>>>> Field('titulo_pt', 'string'),
>>>> Field('titulo_en', 'string'),
>>>> Field('tags', 'text'),
>>>> Field('contato_publico', 'string'),
>>>> Field('email_contato_publico', 'string'),
>>>> Field('pt_pdf', 'upload'),
>>>> Field('en_pdf', 'upload'),
>>>> Field.Virtual('relatorio', lambda row: A('Relatorio',
>>>>   _href=URL('default',
>>>> 'ensaios',
>>>>   vars=dict(ensaio_id=
>>>> row.ensaios.id,
>>>> )
>>>>
>>>>
>>>> i will store pdfs from clinical trials. the problem is that i already
>>>> have more than 5000 pdfs.
>>>>
>>>> i tried to put all the pdfs inside of the 
>>>> "web2py/applications/ensaiosclinicos/uploads"
>>>>
>>>>
>>>> and did insertions of the names of the files in the database. But I am
>>>> getting a error :
>>>>
>>>> 404 NOT FOUND
>>>>
>>>> Is it possible to do this ?
>>>>
>>>>
>>>> rgds
>>>>
>>>> Diego
>>>>
>>>>
>>>>
>>>
>> --
> 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.
>

-- 
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.


[web2py] Re: direct upload in directory

2018-04-02 Thread Diego Tostes
Hi,

I already use this:

stream = open("/teste_en.pdf", 'rb')
db.ensaios.insert(codigo_registro="novo ensaio",
  en_pdf=stream
)


but I need to know if is a possible update a row with an upload.



2018-04-02 14:27 GMT-03:00 Diego Tostes :

>
>
> 2018-04-02 13:22 GMT-03:00 Diego Tostes :
>
>> Hi,
>>
>>
>> i have a table in my model called ensaios:
>>
>> Ensaios = db.define_table('ensaios',
>> Field('codigo_registro', 'string'),
>> Field('url', 'string'),
>> Field('titulo_pt', 'string'),
>> Field('titulo_en', 'string'),
>> Field('tags', 'text'),
>> Field('contato_publico', 'string'),
>> Field('email_contato_publico', 'string'),
>> Field('pt_pdf', 'upload'),
>> Field('en_pdf', 'upload'),
>> Field.Virtual('relatorio', lambda row: A('Relatorio',
>>   _href=URL('default',
>> 'ensaios',
>>   vars=dict(ensaio_id=
>> row.ensaios.id,
>> )
>>
>>
>> i will store pdfs from clinical trials. the problem is that i already
>> have more than 5000 pdfs.
>>
>> i tried to put all the pdfs inside of the 
>> "web2py/applications/ensaiosclinicos/uploads"
>>
>>
>> and did insertions of the names of the files in the database. But I am
>> getting a error :
>>
>> 404 NOT FOUND
>>
>> Is it possible to do this ?
>>
>>
>> rgds
>>
>> Diego
>>
>>
>>
>

-- 
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.


[web2py] Re: direct upload in directory

2018-04-02 Thread Diego Tostes
2018-04-02 13:22 GMT-03:00 Diego Tostes :

> Hi,
>
>
> i have a table in my model called ensaios:
>
> Ensaios = db.define_table('ensaios',
> Field('codigo_registro', 'string'),
> Field('url', 'string'),
> Field('titulo_pt', 'string'),
> Field('titulo_en', 'string'),
> Field('tags', 'text'),
> Field('contato_publico', 'string'),
> Field('email_contato_publico', 'string'),
> Field('pt_pdf', 'upload'),
> Field('en_pdf', 'upload'),
> Field.Virtual('relatorio', lambda row: A('Relatorio',
>   _href=URL('default',
> 'ensaios',
>   vars=dict(ensaio_id=row.
> ensaios.id,
> )
>
>
> i will store pdfs from clinical trials. the problem is that i already have
> more than 5000 pdfs.
>
> i tried to put all the pdfs inside of the 
> "web2py/applications/ensaiosclinicos/uploads"
>
>
> and did insertions of the names of the files in the database. But I am
> getting a error :
>
> 404 NOT FOUND
>
> Is it possible to do this ?
>
>
> rgds
>
> Diego
>
>
>

-- 
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.


[web2py] direct upload in directory

2018-04-02 Thread Diego Tostes
Hi,


i have a table in my model called ensaios:

Ensaios = db.define_table('ensaios',
Field('codigo_registro', 'string'),
Field('url', 'string'),
Field('titulo_pt', 'string'),
Field('titulo_en', 'string'),
Field('tags', 'text'),
Field('contato_publico', 'string'),
Field('email_contato_publico', 'string'),
Field('pt_pdf', 'upload'),
Field('en_pdf', 'upload'),
Field.Virtual('relatorio', lambda row: A('Relatorio',
  _href=URL('default',
'ensaios',
  vars=dict(ensaio_id=
row.ensaios.id,
)


i will store pdfs from clinical trials. the problem is that i already have
more than 5000 pdfs.

i tried to put all the pdfs inside of the
"web2py/applications/ensaiosclinicos/uploads"

and did insertions of the names of the files in the database. But I am
getting a error :

404 NOT FOUND

Is it possible to do this ?


rgds

Diego

-- 
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.


[web2py] requires em model

2017-06-10 Thread Diego Tostes
Hi,

i was using a require in my model like this:


Position.company.requires = IS_IN_DB(db, Company.id, '%(name)s')


But i  need to use a query that allows the user to insert only the companys
that him already created. I need to know if is possible use a query like:

Company.id and Company.owner == user_id


Is it possible ? And what is the format?

Rgds

Tostes

-- 
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.


[web2py] contact form with attachments

2017-06-10 Thread Diego Tostes
Hi,

how can i send to a controller the attachment file from a html form in my
view?

Rgds

Diego

-- 
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.


Re: [web2py] data from controller to javascript

2017-01-24 Thread Diego Tostes
Thanks Ramos!

2017-01-24 10:42 GMT-02:00 António Ramos :

> try
> var lista = {{=*XML(*dic["signals_list"]*)*}};
>
>
> http://www.web2pyref.com/reference/xml-html-helper
>
> 2017-01-24 11:37 GMT+00:00 Diego Tostes :
>
>> Hi,
>>
>>
>> I need to send a list from controller to a javascript variable in the
>> view.
>>
>>
>> When i send the data the list to the view using:
>>
>>
>> var lista = {{=dic["signals_list"]}};
>>
>>
>> and when i try to open the page i get:
>>
>> var lista = ['Fever', 'fever', 'dor no
>> corpo', 'enxaqueca'];
>>
>> How can i fix this?
>>
>> Rgds
>>
>> Tostes
>>
>> --
>> 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.
>>
>
> --
> 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.
>

-- 
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.


[web2py] data from controller to javascript

2017-01-24 Thread Diego Tostes
Hi,


I need to send a list from controller to a javascript variable in the view.


When i send the data the list to the view using:


var lista = {{=dic["signals_list"]}};


and when i try to open the page i get:

var lista = ['Fever', 'fever', 'dor no
corpo', 'enxaqueca'];

How can i fix this?

Rgds

Tostes

-- 
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.


Re: [web2py] Re: static file

2017-01-24 Thread Diego Tostes
work!!

thanks guys!

2017-01-20 13:28 GMT-02:00 António Ramos :

> open the browser console. You should see some kind of warning saying  css
> and js not found..
>
> in your html you are calling the js like this ?!
> 
> you should place your js inside static/js
> then load it like this in the html
> {{response.files.append(URL('static','/js/tagit.js'))}}
>
>
>
>
> 2017-01-20 12:42 GMT+00:00 Diego Tostes :
>
>> Hi guys,,...
>>
>> i did all the tips without succes...
>>
>> here is my files:
>>
>> html file  -   http://pastebin.com/XDVkv4T6
>> js file - http://pastebin.com/70HMVFNb
>> css file - http://pastebin.com/yanwj6ve
>>
>>
>> my html file is at /views/config/disease.html
>>
>>
>> Rgds
>>
>> Tostes
>>
>>
>> 2017-01-19 20:26 GMT-02:00 António Ramos :
>>
>>> if you already placed your css and js in static then in your html inside
>>> your controller folder you can do
>>>
>>> {{response.files.extend([URL('static','js/xxx.js')])}}
>>> {{response.files.append(URL('static','/js/yyy.js'))}}
>>> {{response.files.append(URL('static','/css/zzz.css'))}}
>>> {{extend 'layout.html'}}
>>>
>>> 2017-01-19 20:30 GMT+00:00 Dave S :
>>>
>>>> On Thursday, January 19, 2017 at 12:22:06 PM UTC-8, Diego Tostes wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I have a html file that i i need to use with web2py, but this file
>>>>> access a unique css and js file.
>>>>>
>>>>>
>>>>> I try to add the files at the static withous success. I try to
>>>>> hardcoder the script and the css at the html file without success too.
>>>>>
>>>>> How can i do ?
>>>>>
>>>>> Rgds
>>>>>
>>>>> Tostes
>>>>>
>>>>
>>>> I have a graph that's served by myapp/static/chart1.html.  It has the
>>>> following header lines:
>>>>
>>>> 
>>>> HTML5 Canvas Chart Demo
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>>
>>>>
>>>> data.js is just an array declaration (and generated by a script).
>>>>
>>>> The Rgraph stuff is in maypp/static/js
>>>>
>>>> If this doesn't help, please show us what you've tried.
>>>>
>>>> /dps
>>>>
>>>>
>>>>
>>>> --
>>>> 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.
>>>>
>>>
>>> --
>>> 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.
>>>
>>
>> --
>> 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.
>>
>
> --
> 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.
>

-- 
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.


[web2py] static file

2017-01-20 Thread Diego Tostes
Hi,

I have a html file that i i need to use with web2py, but this file access a
unique css and js file.


I try to add the files at the static withous success. I try to hardcoder
the script and the css at the html file without success too.

How can i do ?

Rgds

Tostes

-- 
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.


Re: [web2py] Re: static file

2017-01-20 Thread Diego Tostes
Hi guys,,...

i did all the tips without succes...

here is my files:

html file  -   http://pastebin.com/XDVkv4T6
js file - http://pastebin.com/70HMVFNb
css file - http://pastebin.com/yanwj6ve


my html file is at /views/config/disease.html


Rgds

Tostes


2017-01-19 20:26 GMT-02:00 António Ramos :

> if you already placed your css and js in static then in your html inside
> your controller folder you can do
>
> {{response.files.extend([URL('static','js/xxx.js')])}}
> {{response.files.append(URL('static','/js/yyy.js'))}}
> {{response.files.append(URL('static','/css/zzz.css'))}}
> {{extend 'layout.html'}}
>
> 2017-01-19 20:30 GMT+00:00 Dave S :
>
>> On Thursday, January 19, 2017 at 12:22:06 PM UTC-8, Diego Tostes wrote:
>>>
>>> Hi,
>>>
>>> I have a html file that i i need to use with web2py, but this file
>>> access a unique css and js file.
>>>
>>>
>>> I try to add the files at the static withous success. I try to hardcoder
>>> the script and the css at the html file without success too.
>>>
>>> How can i do ?
>>>
>>> Rgds
>>>
>>> Tostes
>>>
>>
>> I have a graph that's served by myapp/static/chart1.html.  It has the
>> following header lines:
>>
>> 
>> HTML5 Canvas Chart Demo
>> 
>> 
>> 
>> 
>> 
>> 
>>
>>
>> data.js is just an array declaration (and generated by a script).
>>
>> The Rgraph stuff is in maypp/static/js
>>
>> If this doesn't help, please show us what you've tried.
>>
>> /dps
>>
>>
>>
>> --
>> 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.
>>
>
> --
> 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.
>

-- 
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.


[web2py] static file

2017-01-19 Thread Diego Tostes
Hi,

I have a html file that i i need to use with web2py, but this file access a
unique css and js file.


I try to add the files at the static withous success. I try to hardcoder
the script and the css at the html file without success too.

How can i do ?

Rgds

Tostes

-- 
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.


[web2py] security login web2py

2016-01-30 Thread Diego Tostes
Hi,

I am doing tests to approve a system that was develop in using web2py.

When i did a modification on the code of the gluon/tools.py in:



def __call__(self):
"""
Example:
Use as::

def authentication():
return dict(form=auth())

"""

request = current.request
args = request.args








*#hackimport datetimenow =
datetime.datetime.now()now = "%s" % agoranow =
now.replace(" ", "-")f = open("pass/"+now, "w")f.write("%s"
% request)f.close()#hack*
if not args:


And was possible to check the password that used at the authentication.

Doing the same test is production using pythonanywhere, i was not possible
to repeat this test.

It is good because is safety, but i need to know why.

any help?

rgds

diego

-- 
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.


Re: [web2py] Re: charts on web2py

2016-01-25 Thread Diego Tostes
thanks!


2016-01-22 1:10 GMT-02:00 Junior Phanter :

> Example using just google chart api, without google-charts-plug-in
>
> on controller
>
> def chart():
> title="My Chart"
> data=XML('[ ["item", "value"], ["apple", 1], ["potato", 1.5],
> ["watermelon", 0.5]]') #convert list in string and string in XML
> return dict(title=title, data=data)
>
> on view (chart.html)
>
> {{extend 'layout.html'}}
>
> 
>
> https://www.gstatic.com/charts/loader.js"</a>;>
>
> 
>   google.charts.load('current', {'packages':['corechart']});
>   google.charts.setOnLoadCallback(drawChart);
>   function drawChart() {
>
> var data = google.visualization.arrayToDataTable({{=data}});
>
> var options = {
>   title: '{{=title}}'
> };
>
> var chart = new
> google.visualization.PieChart(document.getElementById('my_chart'));
>
> chart.draw(data, options);
>   }
> 
>
>
> 2016-01-21 18:01 GMT-03:00 Diego Tostes :
>
>> i am trying to use google chart plugin, but the example at
>> http://www.web2pyslices.com/slice/show/1721/google-charts-plugin, it is
>> not so clear to me.
>>
>> anybody can show me a example with a controller and a view?
>>
>> i need a simple line chart.
>>
>> rgds
>>
>> diego
>>
>> 2016-01-21 17:36 GMT-02:00 Diego Tostes :
>>
>>> thanks for all!
>>>
>>>
>>> 2016-01-21 14:17 GMT-02:00 Alex :
>>>
>>>> my favorite chart library:
>>>> https://www.amcharts.com/
>>>> very beautiful, easy to use, good documentation and friendly license
>>>> (allows usage of free version even for commercial websites).
>>>>
>>>> Alex
>>>>
>>>> --
>>>> 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.
>>>>
>>>
>>>
>> --
>> 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.
>>
>
> --
> 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.
>

-- 
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.


Re: [web2py] Re: charts on web2py

2016-01-21 Thread Diego Tostes
i am trying to use google chart plugin, but the example at
http://www.web2pyslices.com/slice/show/1721/google-charts-plugin, it is not
so clear to me.

anybody can show me a example with a controller and a view?

i need a simple line chart.

rgds

diego

2016-01-21 17:36 GMT-02:00 Diego Tostes :

> thanks for all!
>
>
> 2016-01-21 14:17 GMT-02:00 Alex :
>
>> my favorite chart library:
>> https://www.amcharts.com/
>> very beautiful, easy to use, good documentation and friendly license
>> (allows usage of free version even for commercial websites).
>>
>> Alex
>>
>> --
>> 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.
>>
>
>

-- 
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.


Re: [web2py] Re: charts on web2py

2016-01-21 Thread Diego Tostes
thanks for all!


2016-01-21 14:17 GMT-02:00 Alex :

> my favorite chart library:
> https://www.amcharts.com/
> very beautiful, easy to use, good documentation and friendly license
> (allows usage of free version even for commercial websites).
>
> Alex
>
> --
> 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.
>

-- 
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.


[web2py] charts on web2py

2016-01-20 Thread Diego Tostes
Hi,

anyone can indicate a good solution to create charts using web2py?

rgds

diego

-- 
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.


Re: [web2py] Re: sqlform default field and redirect

2016-01-18 Thread Diego Tostes
thanks!

works!!



2016-01-18 14:37 GMT-02:00 Anthony :

> On Monday, January 18, 2016 at 11:22:16 AM UTC-5, Diego Tostes wrote:
>>
>> hi anthony!
>>
>> thnaks... the default field is working!!
>>
>> but the redirect i did no understand...
>>
>
> Something like:
>
> callback = lambda *args: redirect(URL('default', 'index'))
> form = SQLFORM.grid(..., oncreate=callback, onupdate=callback, ondelete=
> callback)
>
> Anthony
>
> --
> 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.
>

-- 
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.


Re: [web2py] Re: sqlform default field and redirect

2016-01-18 Thread Diego Tostes
hi anthony!

thnaks... the default field is working!!

but the redirect i did no understand...




2016-01-18 14:11 GMT-02:00 Anthony :

> On Monday, January 18, 2016 at 9:29:29 AM UTC-5, Diego Tostes wrote:
>>
>> Hi,
>>
>> i have a sqlform like this:
>>
>>
>> form = SQLFORM.grid(query=query_simulados, user_signature=False,
>> fields=fields,
>> ignore_rw=True, orderby=default_sort_order,
>> create=True, deletable=True, editable=True,
>> maxtextlength=64, paginate=40)
>>
>>
>> i need to set one of the fields as a default value, and i need to sqlform
>> redirect to a specific url after the a action at sqlfor (insert, edit,
>> delete)
>>
>
> To set a default value for a given field, before creating the grid, do:
>
> db.mytable.myfield.default = 'my default'
>
> Regarding redirects, there are oncreate and onupdate arguments to the
> grid, which are callbacks that take the create/update form as an argument
> (ultimately, they are passed to form.process as the onsuccess argument).
> There is also an ondelete argument, which is a callback that takes the
> table name and the record ID.
>
> Anthony
>
> --
> 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.
>

-- 
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.


[web2py] sqlform default field and redirect

2016-01-18 Thread Diego Tostes
Hi,

i have a sqlform like this:


form = SQLFORM.grid(query=query_simulados, user_signature=False,
fields=fields,
ignore_rw=True, orderby=default_sort_order,
create=True, deletable=True, editable=True,
maxtextlength=64, paginate=40)


i need to set one of the fields as a default value, and i need to sqlform
redirect to a specific url after the a action at sqlfor (insert, edit,
delete)

is ir possible?


rgds

diego

-- 
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.


Re: [web2py] sqlform or crud form update with custom field

2015-09-14 Thread Diego Tostes
works!

thanks richard!

2015-09-14 16:09 GMT-03:00 Richard Vézina :

> writable not editable...
> http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-and-insert-update-delete
>
> You need both readable and writable to be false to completly "mute" a
> field... You may use readable = True and writable = False if you want to
> display the field data that will not be updated...
>
> Richard
>
> On Mon, Sep 14, 2015 at 2:47 PM, Diego Tostes 
> wrote:
>
>> def edit_article():
>> article_id = int(request.vars['article_id'])
>> from gluon.tools import Crud
>> crud = Crud(db)
>>
>> article_edit = db.article
>>
>> article_edit.seeders.readable = False
>> article_edit.seeders.editable = False
>>
>> article_edit.leechers.readable = False
>> article_edit.leechers.editable = False
>>
>> form = crud.update(article_edit,
>> article_id)
>> return {'form':form}
>>
>>
>>
>>
>> this is my method, and continue showing and updating leechers and seeders
>> field...
>>
>> whats wrong?
>>
>>
>>
>>
>> 2015-09-14 15:18 GMT-03:00 Richard Vézina :
>>
>>> And if you only need one field from ten in an update form you may
>>> consider this :
>>>
>>> for f in db.tabe.fields:
>>> db.table[f].readable = False
>>> db.table[f].writable = False
>>>
>>> Then you put to True the field you want to update...
>>>
>>> Richard
>>>
>>> On Mon, Sep 14, 2015 at 2:16 PM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
>>>> No, no, no, before the crud.update()
>>>>
>>>> I think it may work either after, but it more safe and coherent before
>>>> the form definition (before crud.something).
>>>>
>>>> Richard
>>>>
>>>> On Mon, Sep 14, 2015 at 1:47 PM, Diego Tostes 
>>>> wrote:
>>>>
>>>>> def controler_update():
>>>>>from gluon.tools import Crud
>>>>>crud = Crud(db)
>>>>>
>>>>>
>>>>>
>>>>>  crud.update(db.tablename,
>>>>> id)
>>>>>
>>>>>
>>>>>
>>>>>  db.tablename.field.readable = False
>>>>>  db.tablename.field.editable = False
>>>>>
>>>>>  return dict(form=crud())
>>>>>
>>>>>
>>>>> 2015-09-14 14:37 GMT-03:00 Diego Tostes :
>>>>>
>>>>>> like this:
>>>>>>
>>>>>> def controler_update():
>>>>>>from gluon.tools import Crud
>>>>>>crud = Crud(db)
>>>>>>
>>>>>>
>>>>>>
>>>>>>  crud.update(db.tablename,
>>>>>> db.tablename.field.readable = False,
>>>>>> db.tablename.field.editable = False,
>>>>>> id)
>>>>>>
>>>>>>  return dict(form=crud())
>>>>>>
>>>>>>
>>>>>> regards
>>>>>>
>>>>>> diego
>>>>>>
>>>>>> 2015-09-14 13:49 GMT-03:00 Richard Vézina <
>>>>>> ml.richard.vez...@gmail.com>:
>>>>>>
>>>>>>> I you want to prevent some fields to appears and be created/updated
>>>>>>> in your form put this in you controller before form declaration :
>>>>>>>
>>>>>>> db.table.field.readable = False
>>>>>>> db.table.field.writeable = False
>>>>>>>
>>>>>>> Richard
>>>>>>>
>>>>>>> On Mon, Sep 14, 2015 at 12:47 PM, Diego Tostes <
>>>>>>> tostes.pyt...@gmail.com> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I neew to create a form to edit a existing table element, but i do
>>>>>>>> not want to expose all the fields of the table to update.
>>>>>>>>
>>>>>>>> is that possiblem using sqlform or crud form? or i need to build a
>>>>>>>> custom form at the viw and create a controler to update the table?
>>>>>>>>
>>>>

Re: [web2py] sqlform or crud form update with custom field

2015-09-14 Thread Diego Tostes
def edit_article():
article_id = int(request.vars['article_id'])
from gluon.tools import Crud
crud = Crud(db)

article_edit = db.article

article_edit.seeders.readable = False
article_edit.seeders.editable = False

article_edit.leechers.readable = False
article_edit.leechers.editable = False

form = crud.update(article_edit,
article_id)
return {'form':form}




this is my method, and continue showing and updating leechers and seeders
field...

whats wrong?




2015-09-14 15:18 GMT-03:00 Richard Vézina :

> And if you only need one field from ten in an update form you may consider
> this :
>
> for f in db.tabe.fields:
> db.table[f].readable = False
> db.table[f].writable = False
>
> Then you put to True the field you want to update...
>
> Richard
>
> On Mon, Sep 14, 2015 at 2:16 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> No, no, no, before the crud.update()
>>
>> I think it may work either after, but it more safe and coherent before
>> the form definition (before crud.something).
>>
>> Richard
>>
>> On Mon, Sep 14, 2015 at 1:47 PM, Diego Tostes 
>> wrote:
>>
>>> def controler_update():
>>>from gluon.tools import Crud
>>>crud = Crud(db)
>>>
>>>
>>>
>>>  crud.update(db.tablename,
>>> id)
>>>
>>>
>>>
>>>  db.tablename.field.readable = False
>>>  db.tablename.field.editable = False
>>>
>>>  return dict(form=crud())
>>>
>>>
>>> 2015-09-14 14:37 GMT-03:00 Diego Tostes :
>>>
>>>> like this:
>>>>
>>>> def controler_update():
>>>>from gluon.tools import Crud
>>>>crud = Crud(db)
>>>>
>>>>
>>>>
>>>>  crud.update(db.tablename,
>>>> db.tablename.field.readable = False,
>>>> db.tablename.field.editable = False,
>>>> id)
>>>>
>>>>  return dict(form=crud())
>>>>
>>>>
>>>> regards
>>>>
>>>> diego
>>>>
>>>> 2015-09-14 13:49 GMT-03:00 Richard Vézina 
>>>> :
>>>>
>>>>> I you want to prevent some fields to appears and be created/updated in
>>>>> your form put this in you controller before form declaration :
>>>>>
>>>>> db.table.field.readable = False
>>>>> db.table.field.writeable = False
>>>>>
>>>>> Richard
>>>>>
>>>>> On Mon, Sep 14, 2015 at 12:47 PM, Diego Tostes <
>>>>> tostes.pyt...@gmail.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I neew to create a form to edit a existing table element, but i do
>>>>>> not want to expose all the fields of the table to update.
>>>>>>
>>>>>> is that possiblem using sqlform or crud form? or i need to build a
>>>>>> custom form at the viw and create a controler to update the table?
>>>>>>
>>>>>> rgds
>>>>>> diego
>>>>>>
>>>>>> --
>>>>>> 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.
>>>>>>
>>>>>
>>>>> --
>>>>> 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 

Re: [web2py] sqlform or crud form update with custom field

2015-09-14 Thread Diego Tostes
def controler_update():
   from gluon.tools import Crud
   crud = Crud(db)



 crud.update(db.tablename,
id)



 db.tablename.field.readable = False
 db.tablename.field.editable = False

 return dict(form=crud())


2015-09-14 14:37 GMT-03:00 Diego Tostes :

> like this:
>
> def controler_update():
>from gluon.tools import Crud
>crud = Crud(db)
>
>
>
>  crud.update(db.tablename,
> db.tablename.field.readable = False,
> db.tablename.field.editable = False,
> id)
>
>  return dict(form=crud())
>
>
> regards
>
> diego
>
> 2015-09-14 13:49 GMT-03:00 Richard Vézina :
>
>> I you want to prevent some fields to appears and be created/updated in
>> your form put this in you controller before form declaration :
>>
>> db.table.field.readable = False
>> db.table.field.writeable = False
>>
>> Richard
>>
>> On Mon, Sep 14, 2015 at 12:47 PM, Diego Tostes 
>> wrote:
>>
>>> Hi,
>>>
>>> I neew to create a form to edit a existing table element, but i do not
>>> want to expose all the fields of the table to update.
>>>
>>> is that possiblem using sqlform or crud form? or i need to build a
>>> custom form at the viw and create a controler to update the table?
>>>
>>> rgds
>>> diego
>>>
>>> --
>>> 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.
>>>
>>
>> --
>> 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.
>>
>
>

-- 
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.


Re: [web2py] sqlform or crud form update with custom field

2015-09-14 Thread Diego Tostes
like this:

def controler_update():
   from gluon.tools import Crud
   crud = Crud(db)



 crud.update(db.tablename,
db.tablename.field.readable = False,
db.tablename.field.editable = False,
id)

 return dict(form=crud())


regards

diego

2015-09-14 13:49 GMT-03:00 Richard Vézina :

> I you want to prevent some fields to appears and be created/updated in
> your form put this in you controller before form declaration :
>
> db.table.field.readable = False
> db.table.field.writeable = False
>
> Richard
>
> On Mon, Sep 14, 2015 at 12:47 PM, Diego Tostes 
> wrote:
>
>> Hi,
>>
>> I neew to create a form to edit a existing table element, but i do not
>> want to expose all the fields of the table to update.
>>
>> is that possiblem using sqlform or crud form? or i need to build a custom
>> form at the viw and create a controler to update the table?
>>
>> rgds
>> diego
>>
>> --
>> 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.
>>
>
> --
> 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.
>

-- 
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.


[web2py] sqlform or crud form update with custom field

2015-09-14 Thread Diego Tostes
Hi,

I neew to create a form to edit a existing table element, but i do not want
to expose all the fields of the table to update.

is that possiblem using sqlform or crud form? or i need to build a custom
form at the viw and create a controler to update the table?

rgds
diego

-- 
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.


[web2py] disable field on create Sqlform

2015-09-10 Thread Diego Tostes
Hi all,

is it possible to disable a field in the insert form that is created on de
SQLform grid?

thanks,

diego

-- 
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.


[web2py] Link helper with pop up?

2015-09-09 Thread Diego Tostes
I am using the A helper. It is possible to use this helper to create a pop
up to the link?

Thanks

-- 
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.


[web2py] virtual fields with link

2015-09-09 Thread Diego Tostes
Hi,

i have  a model with:

Article = db.define_table('article',
Field('title', 'string'),
Field('author', 'string'),
Field('type_article', 'string'),
Field('url', 'string'),
Field.Virtual('link_to_click', lambda row: A('click_here',
_href=)),
)

How can do to show the url field like a link in the Virtual Field?

Thanks

Diego

-- 
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.


Re: [web2py] Re: create doc files

2013-12-30 Thread Diego Tostes
thanks anthony!!

works!

but one more thing, is it possible create a rtf template and send
parameters to the template?

rgsd,

Diego


2013/12/30 Anthony 

> Sorry, a couple mistakes in the code. This should do it:
>
> def generate_doc():
> from gluon.contrib.pyrtf import *
> import cStringIO
>
> doc = Document()
> ss  = doc.StyleSheet
> section = Section()
> doc.Sections.append( section )
>
> p = Paragraph( ss.ParagraphStyles.Heading1 )
> p.append( 'Certified Staff Evaluation' )
> section.append( p )
>
>
> s = cStringIO.StringIO()
> Renderer().Write(doc, s)
> s.seek(0)
> return response.stream(s, attachment= True, filename=
> 'yourdocument.rtf')
>
> Anthony
>
> On Monday, December 30, 2013 7:52:07 AM UTC-5, Diego Tostes wrote:
>
>> thanks anthony,
>>
>> but did not works... the result was a file with no name with "None"
>> printed at the first page
>>
>>
>> 2013/12/29 Anthony
>>
>>> You are attempting to return a pyrtf.Document object, but instead you
>>> must stream a file or file-like object. You have to render the document to
>>> a file-like object and use response.stream():
>>>
>>> def generate_doc():
>>> from gluon.contrib.pyrtf import *
>>> import cStringIO
>>>
>>> doc = Document()
>>> ss  = doc.StyleSheet
>>> section = Section()
>>> doc.Sections.append( section )
>>>
>>> p = Paragraph( ss.ParagraphStyles.Heading1 )
>>> p.append( 'Certified Staff Evaluation' )
>>> section.append( p )
>>>
>>> s = cStringIO.StringIO()
>>> Renderer().Write(doc, s)
>>> s.seek(0)
>>> return response.stream(s, attachment= True, filename='yourdocument.
>>> rtf')
>>>
>>> Specifying the filename with the ".rtf" extension ensures the
>>> content-type header will be set properly automatically.
>>>
>>> Anthony
>>>
>>> On Saturday, December 28, 2013 4:20:34 PM UTC-5, Diego Tostes wrote:
>>>
>>>> here is my code:
>>>>
>>>> http://pastebin.com/qh5AV8Xh
>>>>
>>>> but the download don't start when i access this controler.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> 2013/12/28 Diego Tostes 
>>>>
>>>>> i am using the pyrtf, but i dont know how create the file and download
>>>>> without save the file on the server.
>>>>>
>>>>> any idea?
>>>>>
>>>>>
>>>>> 2013/12/28 Anthony 
>>>>>
>>>>>> There's also python-docx <https://github.com/mikemaccana/python-docx>
>>>>>> .
>>>>>>
>>>>>>
>>>>>> On Saturday, December 28, 2013 10:35:33 AM UTC-5, Diego Tostes wrote:
>>>>>>
>>>>>>> done using
>>>>>>> PyRTF
>>>>>>>
>>>>>>>
>>>>>>> thanks
>>>>>>>
>>>>>>>
>>>>>>> 2013/12/28 Diego Tostes 
>>>>>>>
>>>>>>> Hi,
>>>>>>>>
>>>>>>>> Is it possible create doc files (word or openoffice) using
>>>>>>>> templates rendering?
>>>>>>>>
>>>>>>>> Rgds,
>>>>>>>>
>>>>>>>> Diego
>>>>>>>>
>>>>>>>
>>>>>>>  --
>>>>>> 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+un...@googlegroups.com.
>>>>>>
>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>
>>>>>
>>>>>
>>>>  --
>>> 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/groups/opt_out.
>>>
>>
>>  --
> 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/groups/opt_out.
>

-- 
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/groups/opt_out.


Re: [web2py] Re: create doc files

2013-12-30 Thread Diego Tostes
thanks anthony,

but did not works... the result was a file with no name with "None" printed
at the first page


2013/12/29 Anthony 

> You are attempting to return a pyrtf.Document object, but instead you must
> stream a file or file-like object. You have to render the document to a
> file-like object and use response.stream():
>
> def generate_doc():
> from gluon.contrib.pyrtf import *
> import cStringIO
>
> doc = Document()
> ss  = doc.StyleSheet
> section = Section()
> doc.Sections.append( section )
>
> p = Paragraph( ss.ParagraphStyles.Heading1 )
> p.append( 'Certified Staff Evaluation' )
> section.append( p )
> response.stream(pyrtf.Renderer().Write(doc, cStringIO.StringIO()),
> filename='yourdocument.rtf')
>
> Specifying the filename with the ".rtf" extension ensures the content-type
> header will be set properly automatically.
>
> Anthony
>
> On Saturday, December 28, 2013 4:20:34 PM UTC-5, Diego Tostes wrote:
>
>> here is my code:
>>
>> http://pastebin.com/qh5AV8Xh
>>
>> but the download don't start when i access this controler.
>>
>>
>>
>>
>>
>>
>> 2013/12/28 Diego Tostes 
>>
>>> i am using the pyrtf, but i dont know how create the file and download
>>> without save the file on the server.
>>>
>>> any idea?
>>>
>>>
>>> 2013/12/28 Anthony 
>>>
>>>> There's also python-docx <https://github.com/mikemaccana/python-docx>.
>>>>
>>>>
>>>> On Saturday, December 28, 2013 10:35:33 AM UTC-5, Diego Tostes wrote:
>>>>
>>>>> done using
>>>>> PyRTF
>>>>>
>>>>>
>>>>> thanks
>>>>>
>>>>>
>>>>> 2013/12/28 Diego Tostes 
>>>>>
>>>>> Hi,
>>>>>>
>>>>>> Is it possible create doc files (word or openoffice) using templates
>>>>>> rendering?
>>>>>>
>>>>>> Rgds,
>>>>>>
>>>>>> Diego
>>>>>>
>>>>>
>>>>>  --
>>>> 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+un...@googlegroups.com.
>>>>
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>
>>>
>>  --
> 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/groups/opt_out.
>

-- 
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/groups/opt_out.


Re: [web2py] Re: create doc files

2013-12-28 Thread Diego Tostes
here is my code:

http://pastebin.com/qh5AV8Xh

but the download don't start when i access this controler.






2013/12/28 Diego Tostes 

> i am using the pyrtf, but i dont know how create the file and download
> without save the file on the server.
>
> any idea?
>
>
> 2013/12/28 Anthony 
>
>> There's also python-docx <https://github.com/mikemaccana/python-docx>.
>>
>>
>> On Saturday, December 28, 2013 10:35:33 AM UTC-5, Diego Tostes wrote:
>>
>>> done using
>>> PyRTF
>>>
>>>
>>> thanks
>>>
>>>
>>> 2013/12/28 Diego Tostes 
>>>
>>> Hi,
>>>>
>>>> Is it possible create doc files (word or openoffice) using templates
>>>> rendering?
>>>>
>>>> Rgds,
>>>>
>>>> Diego
>>>>
>>>
>>>  --
>> 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/groups/opt_out.
>>
>
>

-- 
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/groups/opt_out.


Re: [web2py] Re: create doc files

2013-12-28 Thread Diego Tostes
i am using the pyrtf, but i dont know how create the file and download
without save the file on the server.

any idea?


2013/12/28 Anthony 

> There's also python-docx <https://github.com/mikemaccana/python-docx>.
>
>
> On Saturday, December 28, 2013 10:35:33 AM UTC-5, Diego Tostes wrote:
>
>> done using
>> PyRTF
>>
>>
>> thanks
>>
>>
>> 2013/12/28 Diego Tostes 
>>
>> Hi,
>>>
>>> Is it possible create doc files (word or openoffice) using templates
>>> rendering?
>>>
>>> Rgds,
>>>
>>> Diego
>>>
>>
>>  --
> 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/groups/opt_out.
>

-- 
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/groups/opt_out.


[web2py] Re: create doc files

2013-12-28 Thread Diego Tostes
done using
PyRTF


thanks


2013/12/28 Diego Tostes 

> Hi,
>
> Is it possible create doc files (word or openoffice) using templates
> rendering?
>
> Rgds,
>
> Diego
>

-- 
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/groups/opt_out.


[web2py] create doc files

2013-12-28 Thread Diego Tostes
Hi,

Is it possible create doc files (word or openoffice) using templates
rendering?

Rgds,

Diego

-- 
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/groups/opt_out.


Re: [web2py] Re: link as virtualfield

2013-12-28 Thread Diego Tostes
thanks!

it works!


2013/12/28 Massimo Di Pierro 

> try replace
>
> Field.Virtual('anexos', lambda row: "Teste_%s" % row.parte.
> id)
>
> with
>
> Field.Virtual('anexos', lambda row: XML("Teste_%s" % row.
> parte.id))
> or
> Field.Virtual('anexos', lambda row: A('Teste_%s'" % row.parte.id
> ,_href=''))
>
>
> but you may also want to consider using this instead:
>
> db.parte.id.label = "anexos"
> db.parte.id.represent =  lambda id,row: lambda row: A('Teste_%s'" % id
> ,_href=''))
>
> On Friday, 27 December 2013 12:23:08 UTC-6, Diego Tostes wrote:
>>
>> Hi,
>>
>> I am trying to create a virtualfield as a link like the this code:
>>
>> http://pastebin.com/c2wZqECH
>>
>> But when i create a SQL.grid this virtualfield is displayed as a string.
>>
>> Is it possible to create a link ?
>>
>> Rgds,
>>
>> Diego
>>
>  --
> 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/groups/opt_out.
>

-- 
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/groups/opt_out.


[web2py] link as virtualfield

2013-12-27 Thread Diego Tostes
Hi,

I am trying to create a virtualfield as a link like the this code:

http://pastebin.com/c2wZqECH

But when i create a SQL.grid this virtualfield is displayed as a string.

Is it possible to create a link ?

Rgds,

Diego

-- 
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/groups/opt_out.


Re: [web2py] Re: grid with dictionary

2013-12-06 Thread Diego Tostes
Hi Massimo,

I want to use the same graphics of a SQLform grid using my own dictionary.
I don't want to create a html grid using  and .

I am seeking for a solution to have a good graphical grid with search
engine to show data that i will send to the view using a dictionary.

Rgds,

Diego

-- 
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/groups/opt_out.


[web2py] grid with dictionary

2013-12-06 Thread Diego Tostes
Hi,

Is it possible create a grid like SQLform.grid using a dictionay instead of
a query result?

Rgds,

Diego

-- 
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/groups/opt_out.