[web2py] Re: default value condition base on time

2016-02-09 Thread 黄祥
thank you so much dave it work perfectly
e.g.
table.shift.default = 1 if request.now.hour >= 0 & request.now.hour <=8 
else 2 if request.now.hour >= 8 & request.now.hour <=16 else 3

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


[web2py] Re: Is there anyway to disable search and export sections in SQLFORM.grid

2016-02-09 Thread Anthony
SQLFORM.grid(..., searchable=False, csv=False)

Anthony

On Tuesday, February 9, 2016 at 3:26:04 PM UTC-5, SanDiego wrote:
>
> The only way I can disable search and exports sections is through 
> 'display:none;' style option. Is there any settings to disable them?
>

-- 
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: How to set default country in dropdown list

2016-02-09 Thread Dave S


On Tuesday, February 9, 2016 at 5:10:03 PM UTC-8, Winter Kryz wrote:
>
> Thanks for the answers
> I tried what xmarx said but it didn't work 
>

What errors did you get?

 

> How would I use it with IS_IN_SET?
>
>
nationalities=['United States',"United Kingdom","France",'Germany']


db.define_table('Person',
Field('last_name', 'string'),
Field('name', 'string'),
Field('telephone', 'string'),
Field('email', 'string'),
Field('nationality', requires=IS_IN_SET(nationalities), 
default='United States')
format= '%(last_name)s,%(name)s '
   )



(Not tested)

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


[web2py] Re: How to set default country in dropdown list

2016-02-09 Thread Winter Kryz
Thanks for the answers
I tried what xmarx said but it didn't work 
How would I use it with IS_IN_SET?

-- 
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: Is there anyway to disable search and export sections in SQLFORM.grid

2016-02-09 Thread Jim S
Set the search_widget arg to an empty form on the SQLFORM.grid call.  

SQLFORM.grid(other_arguments..., search_widget=FORM())

-Jim


On Tuesday, February 9, 2016 at 2:26:04 PM UTC-6, SanDiego wrote:
>
> The only way I can disable search and exports sections is through 
> 'display:none;' style option. Is there any settings to disable them?
>

-- 
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: Smartgrid internal table ordering

2016-02-09 Thread Jim S
The orderby should be a dict with the table_name as the key.  The value 
should be the orderby used for that specific table.

-Jim

On Tuesday, February 9, 2016 at 2:25:52 PM UTC-6, Vikash Sharma wrote:
>
>
> I have a smartgrid as follows
>
>
> *grid = SQLFORM.smartgrid(db.receipt, linked_tables=['items'], orderby="id 
> DESC")*
>
> Using this, *receipt *table is shown correctly as order in descending 
> order. But internal table *items* is also getting ordered in descending 
> order. 
>
> If I do  
>
> *grid = SQLFORM.smartgrid(db.receipt, linked_tables=['items'], 
> orderby="receipt.id  DESC")*
>
> Then *receipt* table is fine but on click/view for *items* table, it 
> gives error that *receipt.id * is unknown column. 
>
> I want outer table ordered DESC but not internal/child table. 
>
> Please help. 
>
>

-- 
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: default value condition base on time

2016-02-09 Thread Dave S


On Tuesday, February 9, 2016 at 12:14:08 PM UTC-8, 黄祥 wrote:
>
> is it possible to have default value condition base on time? i tried 
> before but return an error
> e.g. 1
>
> table.shift.default = 1 if request.now.hour() >= 0 & request.now.hour() <= 8 
> else 2 if request.now.hour() >= 8 & request.now.hour() <= 16 else 3
> TypeError: 'int' object is not callable
>
>
request.now.hour isn't a function, it looks like, which fits with 
request.now being a datetime.datetime object ... hour is an attribute. 
 Take out the parens.


 

> e.g. 2 
>
table.shift.default = 1 if int(request.now.hour() ) >= 0 & 
int(request.now.hour() ) <= 8 else 2 if int(request.now.hour() ) >= 8 & 
int(request.now.hour() ) <= 16 else 3
> TypeError: 'int' object is not callable
>
> any idea how to achive it in web2py way?
>
>
/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.


[web2py] SQLFORM buttons are misaligned

2016-02-09 Thread SanDiego
When used with buttons as follows, SQL form misses the offset causing the 
buttons misplaced towards left (see buttons-misaligned.png file).

buttons = [
TAG.button(T('Save'),_type="submit",_value="save",_class="btn 
btn-primary"),
TAG.button(T('Cancel'),_type="button", _class="btn btn-cancel 
pull-right",_onClick = "parent.location='%s' " % URL('index'))
]

form = SQLFORM(db.person, buttons= buttons)

As a workaround, inside  gluon/sqlhtml.py file I modified the following line
 _controls = DIV(controls, _help, _class=col_class)
with 
_controls = DIV(controls, _help, _class="%s %s" % 
(offset_class, col_class))
Then the form looks as expected (see "buttons-aligned.png" file). I am not 
sure whether my fix has any side-effects though.

As a reference this is the whole function:
def formstyle_bootstrap3_inline_factory(col_label_size=3):
""" bootstrap 3 horizontal form layout

Note:
Experimental!
"""
def _inner(form, fields):
form.add_class('form-horizontal')
label_col_class = "col-sm-%d" % col_label_size
col_class = "col-sm-%d" % (12 - col_label_size)
offset_class = "col-sm-offset-%d" % col_label_size
parent = CAT()
for id, label, controls, help in fields:
# wrappers
_help = SPAN(help, _class='help-block')
# embed _help into _controls
# SALIH changed the following line
# _controls = DIV(controls, _help, _class=col_class)
_controls = DIV(controls, _help, _class="%s %s" % 
(offset_class, col_class))
if isinstance(controls, INPUT):
if controls['_type'] == 'submit':
controls.add_class('btn btn-primary')
_controls = DIV(controls, _class="%s %s" % (col_class, 
offset_class))
if controls['_type'] == 'button':
controls.add_class('btn btn-default')
elif controls['_type'] == 'file':
controls.add_class('input-file')
elif controls['_type'] in ('text', 'password'):
controls.add_class('form-control')
elif controls['_type'] == 'checkbox':
label['_for'] = None
label.insert(0, controls)
_controls = DIV(DIV(label, _help, _class="checkbox"),
_class="%s %s" % (offset_class, 
col_class))
label = ''
elif isinstance(controls, (SELECT, TEXTAREA)):
controls.add_class('form-control')

elif isinstance(controls, SPAN):
_controls = P(controls.components,
  _class="form-control-static %s" % col_class)
elif isinstance(controls, UL):
for e in controls.elements("input"):
e.add_class('form-control')
elif controls is None or isinstance(controls, basestring):
_controls = P(controls, _class="form-control-static %s" % 
col_class)
if isinstance(label, LABEL):
label['_class'] = 
add_class(label.get('_class'),'control-label %s' % label_col_class)

parent.append(DIV(label, _controls, _class='form-group', 
_id=id))
return parent
return _inner

I wanted to share it and your feedback from fellow developers.

-- 
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 there anyway to disable search and export sections in SQLFORM.grid

2016-02-09 Thread SanDiego
The only way I can disable search and exports sections is through 
'display:none;' style option. Is there any settings to disable them?

-- 
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] Displalay a form in light box or pop up window in view

2016-02-09 Thread billmackalister
Hello, A new user migrating from Django to web2py and absolutely loving it. 
A quick question. How do I use a light box or a pop up window to display a 
form in my view?


for example in default/index.html

{{=form}}

Want to show that form  in a pop up window.  

-- 
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] Smartgrid internal table ordering

2016-02-09 Thread Vikash Sharma

I have a smartgrid as follows


*grid = SQLFORM.smartgrid(db.receipt, linked_tables=['items'], orderby="id 
DESC")*

Using this, *receipt *table is shown correctly as order in descending 
order. But internal table *items* is also getting ordered in descending 
order. 

If I do  

*grid = SQLFORM.smartgrid(db.receipt, linked_tables=['items'], 
orderby="receipt.id DESC")*

Then *receipt* table is fine but on click/view for *items* table, it gives 
error that *receipt.id* is unknown column. 

I want outer table ordered DESC but not internal/child table. 

Please help. 

-- 
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: Organize translations

2016-02-09 Thread Massimo Di Pierro
No there is not and doing so by default would slow down the app because 
accessing the file system is a bottle neck. Yet is definitively possible to 
build an app that extract the info from the dictionaries and rearranges 
into multiple files and back. It would be a good exercise to write such an 
app.

On Tuesday, 9 February 2016 08:54:03 UTC-6, Carlos Cesar Caballero wrote:
>
> Hi, I have an app with lot of translation strings, and keeping all in 
> one file is becoming a mess dificult to maintain, is there some way to 
> do something like: 
>
> translatios/ 
>  main/ 
>  default.py 
>  es.py 
>  ... 
>  breads/ 
>  default.py 
>  es.py 
>  ... 
>  species/ 
>  default.py 
>  es.py 
>  ... 
>
> Or something similar to make easier the translation maintainance and 
> reutilization? 
>
> Greetings. 
>
>
> -- 
> Este mensaje le ha llegado mediante el servicio de correo electronico que 
> ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
> Nacional de Salud. La persona que envia este correo asume el compromiso de 
> usar el servicio a tales fines y cumplir con las regulaciones establecidas 
>
> Infomed: http://www.sld.cu/ 
>
>

-- 
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] default value condition base on time

2016-02-09 Thread 黄祥
is it possible to have default value condition base on time? i tried before 
but return an error
e.g. 1

table.shift.default = 1 if request.now.hour() >= 0 & request.now.hour() <= 8 
else 2 if request.now.hour() >= 8 & request.now.hour() <= 16 else 3
TypeError: 'int' object is not callable

e.g. 2

table.shift.default = 1 if int(request.now.hour() ) >= 0 & 
int(request.now.hour() ) <= 8 else 2 if int(request.now.hour() ) >= 8 & 
int(request.now.hour() ) <= 16 else 3
TypeError: 'int' object is not callable

any idea how to achive it in web2py way?

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


[web2py] Re: Can A(cid='...') replace the "loading..." text as LOAD(content='...') does?

2016-02-09 Thread Antonio Salazar
Thanks, this is much better than directly using data-loading-text and 
data-complete-text

On Sunday, February 7, 2016 at 3:31:33 AM UTC-6, Niphlod wrote:
>
> LOAD(...) has a "content" keyword just for it.
> A() doesn't use "loading..." but "working...". it's customizable too, 
> using _disable_with
>
> On Saturday, February 6, 2016 at 12:10:15 AM UTC+1, Antonio Salazar wrote:
>>
>> LOAD(content=x) will replace the button with x (default content is 
>> "loading...") until it gets a response back.
>> A() also replaces itself with "loading..." when using the callback or cid 
>> parameters, but I don't see a builtin way to replace "loading..." with, for 
>> example, a spinner image.
>>
>> What alternatives do I have here?
>>
>

-- 
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: Rows not releasing all the memory back

2016-02-09 Thread Jitun John
I believe it is caching everything to memory.
Here is the code I have.
But yes, not a web2py issue.

def read_manager_rows():
manager_db_conn = DAL('sqlite://manager.sqlite', folder=get_current_path(), 
auto_import=True)
global manager_rows
manager_rows = manager_db_conn(manager_db_conn.manager_log.id > 
0).select(orderby=manager_db_conn.manager_log.datetime)
manager_db_conn.close()

def get_manager_rows():
return manager_rows



On Sunday, February 7, 2016 at 11:10:46 AM UTC+5:30, Massimo Di Pierro 
wrote:
>
> This is not a web2py specific problem. Are you caching something is ram? 
> Do you use a library that may be creating circular references?
>

-- 
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: Make certain fields hidden within a table. Custom form

2016-02-09 Thread Ron Chatterjee
It does except for list:string. lol. Somehow I can't seem to get that to 
work with that.

On Tuesday, February 9, 2016 at 11:13:22 AM UTC-5, Anthony wrote:
>
>
> On Tuesday, February 9, 2016 at 7:22:51 AM UTC-5, Ron Chatterjee wrote:
>>
>> Thank you Anthony. I guess the only caveat is that it can only work with 
>> a boolean. But its great! Solves my problem.
>>
>
> No, it works with any type of field.
>
> 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.


[web2py] Re: Make certain fields hidden within a table. Custom form

2016-02-09 Thread Anthony

On Tuesday, February 9, 2016 at 7:22:51 AM UTC-5, Ron Chatterjee wrote:
>
> Thank you Anthony. I guess the only caveat is that it can only work with a 
> boolean. But its great! Solves my problem.
>

No, it works with any type of field.

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.


Re: [web2py] Re: web2py as a frontend for monitoring serial ports

2016-02-09 Thread José Luis Redrejo
2016-02-09 15:17 GMT+01:00 Oliver Holmes :

> José Luis,
>
> now that sounds promising! So, what I'd do is put my serial port reading
> procedure together with SQL inserts in an endless loop (while True) and
> just let it roll.
>

Right, but you can use DAL, not pure sql if you put the script in the
controllers directory.



> Later on though, I'd like to have it all wrapped up in a service to start,
> whenever the Raspberry booted. I'm guessing, that could be achieved after
> reading one or two how-to articles, so I'm not worried. I'll give this a go
> and let you all know about how it went.
>
>

just add it to /etc/rc.local, it should be as easy as that.




> Regards,
> Oliver
>
> --
> 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] Organize translations

2016-02-09 Thread Carlos Cesar Caballero Díaz
Hi, I have an app with lot of translation strings, and keeping all in 
one file is becoming a mess dificult to maintain, is there some way to 
do something like:


translatios/
main/
default.py
es.py
...
breads/
default.py
es.py
...
species/
default.py
es.py
...

Or something similar to make easier the translation maintainance and 
reutilization?


Greetings.


--
Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

--
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: How to set default country in dropdown list

2016-02-09 Thread Massimo Di Pierro
I would not make this a reference fields. I would make it a IS_IN_SET(...) 
field. This is because possible nationalities do not change very often and 
are definitively not changed by the user.

On Tuesday, 9 February 2016 05:34:29 UTC-6, xmarx wrote:
>
> db.define_table('Person',
> Field('last_name', 'string'),
> Field('name', 'string'),
> Field('telephone', 'string'),
> Field('email', 'string'),
> Field('nationality','reference Nationalities',default=1), 
> format= '%(last_name)s,%(name)s '
>)
>
> default=the id of USA in Nationalities table
>
>
>
> 9 Şubat 2016 Salı 04:35:41 UTC+2 tarihinde Winter Kryz yazdı:
>>
>> Hello everybody,
>>
>> I am new in web2py, I have 2 tables called 'Nationalities' and 'Person'
>>
>> db.define_table('Nationalities',
>> Field('description', 'string'),
>> common_filter = lambda query:db.Nationalities.description 
>> != 'United States',
>> format='%(description)s'
>>)
>>
>> db.define_table('Person',
>> Field('last_name', 'string'),
>> Field('name', 'string'),
>> Field('telephone', 'string'),
>> Field('email', 'string'),
>> Field('nationality','reference 
>> Nationalities',requires=IS_IN_DB(db(db.Nationalities.description), 
>> 'Nationalities.description', zero=T('United States'))),
>> format= '%(last_name)s,%(name)s '
>>)
>> in 'Nationalities', I have listed all the countries of world and what I 
>> get is a dropdown list filled with them
>> Now what I want to do is to display a particular country, let's say 
>> 'United States', at top to be ID 0 in my dropdownlist so when somebody 
>> fills the form the list shows 'United States' by default. I tried to do a 
>> query that shows all the countries except US in the list and then set 'US' 
>> as Zero but of course it didn't work because it says that the value that 
>> zero has it doesn't exist on the database.
>> Please, I need some help because I'm stuck on this.
>> 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.


Re: [web2py] Re: web2py as a frontend for monitoring serial ports

2016-02-09 Thread Oliver Holmes
José Luis,

now that sounds promising! So, what I'd do is put my serial port reading 
procedure together with SQL inserts in an endless loop (while True) and 
just let it roll. Later on though, I'd like to have it all wrapped up in a 
service to start, whenever the Raspberry booted. I'm guessing, that could 
be achieved after reading one or two how-to articles, so I'm not worried. 
I'll give this a go and let you all know about how it went.

Regards,
Oliver 

-- 
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: A dropdown box that filters.

2016-02-09 Thread Jim S
What does your controller look like?

-Jim

On Monday, February 8, 2016 at 8:35:41 PM UTC-6, superpirst wrote:
>
> I created a website that you could post items and I'm having a lot of 
> problem trying to figure out how to make a dropdown menu that can filter 
> those posts. What I'm trying to do is that when you make a post, you can 
> only pick from the 4 categories. Then in the main page, you will have a 
> drop down box where you can select one of those keywords and it will filter 
> out all the posts so that only the posts with that select keyword will 
> show. 
>
> In my db.py I made
>
> post_categories= ['Food', 'Games, 'Hobbies', 'Toys']
>
> db.define_table('posts',
> Field('title', requires=IS_NOT_EMPTY()),
> Field('price'),
> Field('category', requires=IS_IN_SET(post_categories)),
>auth.signature)
>
>
> In my view index.html
>
> I have 
>
> 
>(Select Category)
> 
> I was wondering why on my page, the 4 keywords aren't showing up in the 
> drop down box? 
>
> Also, I heard you can use a form tag(not sure how to work this) to sent 
> the data to another view ("filterCategory"). 
> I'm not sure how to even get this to work. I spent almost a week looking 
> up solutions, but got no where...
>
> Any help will be great!!
> Thank you
>
>  
>

-- 
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: Make certain fields hidden within a table. Custom form

2016-02-09 Thread Ron Chatterjee
Thank you Anthony. I guess the only caveat is that it can only work with a 
boolean. But its great! Solves my problem.

On Monday, February 8, 2016 at 9:46:16 PM UTC-5, Anthony wrote:
>
>
> http://web2py.com/books/default/chapter/29/07/forms-and-validators#Conditional-fields
>
> On Monday, February 8, 2016 at 8:50:40 PM UTC-5, Ron Chatterjee wrote:
>>
>> Wondering if there is a way to keep certain fields within a table be 
>> hidden based on checkbox entry in a field. For example, in the table below, 
>> I would like the Budget field to be hidden until someone click on weekly 
>> checkbox in frequency field. In other words, Budget fields doesn't show up 
>> initially till someone click on weekly checkbox and then the field become 
>> readable and writable. Possible?
>>
>> db.define_table("shopping",
>> Field("Description", "text", label='Summary 
>> Description*',requires=IS_NOT_EMPTY(),default=None,widget=lambda f,v: 
>> SQLFORM.widgets.text.widget(f, v, _placeholder='Write few things to 
>> summarize your posing. For job or a project. ')),
>> Field('frequency', 
>> type='list:string',requires=IS_IN_SET(('Sometime','few time','All the 
>> time', 'weekly'), multiple=True),widget=lambda field,  value: 
>> SQLFORM.widgets.checkboxes.widget(field, value, style='divs', label=True, 
>> _class='horizontal')), 
>> Field("Budget", "integer", label='Budget', default=None),
>> auth.signature)
>>
>>
>>

-- 
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: How to set default country in dropdown list

2016-02-09 Thread xmarx
db.define_table('Person',
Field('last_name', 'string'),
Field('name', 'string'),
Field('telephone', 'string'),
Field('email', 'string'),
Field('nationality','reference Nationalities',default=1), 
format= '%(last_name)s,%(name)s '
   )

default=the id of USA in Nationalities table



9 Şubat 2016 Salı 04:35:41 UTC+2 tarihinde Winter Kryz yazdı:
>
> Hello everybody,
>
> I am new in web2py, I have 2 tables called 'Nationalities' and 'Person'
>
> db.define_table('Nationalities',
> Field('description', 'string'),
> common_filter = lambda query:db.Nationalities.description 
> != 'United States',
> format='%(description)s'
>)
>
> db.define_table('Person',
> Field('last_name', 'string'),
> Field('name', 'string'),
> Field('telephone', 'string'),
> Field('email', 'string'),
> Field('nationality','reference 
> Nationalities',requires=IS_IN_DB(db(db.Nationalities.description), 
> 'Nationalities.description', zero=T('United States'))),
> format= '%(last_name)s,%(name)s '
>)
> in 'Nationalities', I have listed all the countries of world and what I 
> get is a dropdown list filled with them
> Now what I want to do is to display a particular country, let's say 
> 'United States', at top to be ID 0 in my dropdownlist so when somebody 
> fills the form the list shows 'United States' by default. I tried to do a 
> query that shows all the countries except US in the list and then set 'US' 
> as Zero but of course it didn't work because it says that the value that 
> zero has it doesn't exist on the database.
> Please, I need some help because I'm stuck on this.
> 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] Re: IMPORTANT - WEB2PY CONSULTING

2016-02-09 Thread Francisco García
Hi Massimo,

I work as a software consultant and developer. I work with Web2py in my 
projects with customers.
I would like to be in the list of companies

My website is :  www.garciac.es
I offer my consulting services in Spain.

Thank you.
Regards,
Francisco.


El domingo, 15 de febrero de 2015, 23:21:36 (UTC+1), Massimo Di Pierro 
escribió:
>
> We need to update the list of companies that provide web2py consulting.
> This list is obsolete:
>
> http://web2py.com/init/default/support
>
> Some links are broke. Most pages do not even mention web2py. Some of them 
> have a design that is simply not acceptable for a web development company.
>
> That list will be eliminated. IF YOU WANT TO BE LISTED please update your 
> page to have a decent design and MENTION WEB2PY on the main site. Then 
> respond to this thread by providing an updated link and the country were 
> you incorporated. If you have a self-employed individual list your country 
> of residence.
>
>

-- 
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: Spreadsheet.py documentation and status

2016-02-09 Thread Massimiliano
Wow nice w2ui! Thank you for sharing!

On Mon, Feb 8, 2016 at 10:50 AM, Rimantas Nedzinskas 
wrote:

> Try this:
>
>> http://w2ui.com/web/demos/#!combo/combo-3
>>
> --
> 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.
>



-- 
Massimiliano

-- 
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: Web2py-appreport

2016-02-09 Thread Anthony Smith
Hi Massimo,

Thanks for you help you can download form 
here https://github.com/lucasdavila/web2py-appreport/wiki

Thanks for looking into this 

On Tuesday, 9 February 2016 13:37:01 UTC+11, Massimo Di Pierro wrote:
>
>  do not know. Can you post this plugin? I have never seen it. Perhaps 
> assumes a library that is not installed.
>
> On Monday, 8 February 2016 02:24:38 UTC-6, Anthony Smith wrote:
>>
>> Hi Massimo, 
>>
>> Tried that and now getting this error 
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>>
>> Traceback (most recent call last):
>>   File "/home/tony/web2py/gluon/restricted.py", line 227, in restricted
>> exec ccode in environment
>>   File "/home/tony/web2py/applications/reports/models/plugin_appreport.py" 
>> ,
>>  line 25, in 
>> import plugin_appreport as plugin_appreport_module
>>   File "/home/tony/web2py/gluon/custom_import.py", line 85, in 
>> custom_importer
>> modules_prefix, globals, locals, [itemname], level)
>>   File "applications/reports/modules/plugin_appreport/__init__.py", line 2, 
>> in 
>> import report_web2py
>>   File "/home/tony/web2py/gluon/custom_import.py", line 89, in 
>> custom_importer
>> raise ImportError, 'Cannot import module %s' % str(e)
>> ImportError: Cannot import module 
>> 'applications.reports.modules.report_web2py'
>>
>>
>> On Sunday, 7 February 2016 16:43:47 UTC+11, Massimo Di Pierro wrote:
>>>
>>> import modules.plugin_appreport as plugin_appreport_module
>>>
>>> should be
>>>
>>>
>>> import plugin_appreport as plugin_appreport_module
>>>
>>>
>>> On Saturday, 6 February 2016 00:38:24 UTC-6, Anthony Smith wrote:

 Hi All, 

 I was following the tutorial from 
 https://github.com/lucasdavila/web2py-appreport/wiki/Docs-and-examples, 
 Helper for simple reports and get the follow error when I try to open the 
 app 

 Any ideas would be great 

  Cannot import module 
 'applications.reports.modules.modules'Version 
 web2py™ Version 2.13.4-stable+timestamp.2015.12.26.04.59.39 
 Python Python 2.7.6: /usr/bin/python (prefix: /usr) Traceback 

 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.

 Traceback (most recent call last):
   File "/home/tony/web2py/gluon/restricted.py", line 227, in restricted
 exec ccode in environment
   File "/home/tony/web2py/applications/reports/models/plugin_appreport.py" 
 ,
  line 25, in 
 import modules.plugin_appreport as plugin_appreport_module
   File "/home/tony/web2py/gluon/custom_import.py", line 89, in 
 custom_importer
 raise ImportError, 'Cannot import module %s' % str(e)
 ImportError: Cannot import module 'applications.reports.modules.modules'



-- 
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] learning curve?

2016-02-09 Thread Thomas Bellembois

Hi Jon,

I have spent a long time studying the different Python Web frameworks to 
develop a small chemical products management application and I have 
choosen Web2py mainly because of its fast learning curve (and also the 
active community).

The official documentation is a really good point to start.

Start with few pages to play with the model-controller-view structure 
and see.


Regards,

Thomas

On 09/02/2016 01:25, Literate Aspects wrote:

I tried django ... to discover HUGE learning curve
I tried Qt ... to discover moderate learning curve

I can amateur code in VBA and want to transfer that same code function 
to a webapp with database.


My question, how many hours or days or months would it take to develop 
a simple application that controls a web page to enter data into?


Jon
--
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: web2py as a frontend for monitoring serial ports

2016-02-09 Thread José Luis Redrejo
Oliver: I use to do what you need to communicate with Arduino in different
projects. I think it's better if you get rid of the scheduler: you may
loose data if the serial port buffer is full while the scheduler is not
working.
What I use is:

   - write a script in an infinite loop like any usual pyserial script that
   reads from the serial port. The script must have a function that will begin
   the communication with the serial port after being open, def main() could
   be fine.
   - Put the script in the controllers directory of your web application,
   and use dal instructions to put the data in the database you prefer when
   receiving it from arduino. Sqlite is nice if the project won't have too
   many concurrent users.
   - Run the script from the web2py directory using: python web2py.py -M -S
   application_name/script_name/function_name, example  web2py.py -M -S
   scada/arduino/main
   - As you use in the script the same model from your application you can
   use all the data you have received in the db

This method is pretty easy and transparent.


Regards

José L.

2016-02-09 8:25 GMT+01:00 Oliver Holmes :

> Thanks to you both. I should clear up a slight misunderstanding. I have
> written the part, where the serial port is read (using pyserial). I am now
> trying to figure out, how to  connect this to web2py, so that it can serve
> the data nicely. It was my understanding, Massimo, that the scheduler was
> supposed to provide a way to not block the webservice with potentially
> blocking tasks - hence my question. My idea was to fill the SQLite tables I
> created in the web2py model with that scheduled task. Now you have
> discouraged me a bit. Could you please elaborate a bit on how you feel I
> should go about this task?
>
> And thanks, Marcelo, about an hour after my post, I realized that I could
> just download the latest source and use that... I am a little slow ;)
>
> Regards,
> Oliver
>
> Am Montag, 8. Februar 2016 10:23:54 UTC+1 schrieb Oliver Holmes:
>>
>> Hi,
>>
>> I'm new to web2py and quite frankly to python as well, so please bear
>> with me ;)
>> I would like to use web2py to serve data, that it has gathered and
>> processed from the serial port. There is new data available once a second.
>> Obviously I'll have to use the scheduler, to accomplish reading and
>> processing the serial port repeatedly. My question is this: How would I go
>> about setting up that worker task in the scheduler? And by the way, since
>> I'll be doing this on a RaspberryPi, how can I get a newer version than
>> "Version 1.99.7 (2012-03-04 22:12:08)" apt-get will not deliver anything
>> newer for my Raspian...
>>
>> Regards,
>> Oliver
>>
> --
> 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.