Re: [web2py] Re: sqlform insert row id

2021-07-01 Thread Javier Pepe
http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-and-insert-update-delete

In form.vars.id store Last ID inserted

El jue., 1 de julio de 2021 15:47, Dave S  escribió:

>
>
> On Wednesday, June 30, 2021 at 11:35:29 PM UTC-7 Clemens wrote:
>
>> the insert returns the id of the new record.
>>
>> new_id = db.table.insert(...)
>>
>> Have a try!
>>
>
> Well, yes, if you do the insert yourself, but when you're doing SQLFORM,
> it will do the insert.  So you need it to return the new record idea.  Does
> it, and if it does how can I access it?
>
> /dps
>
>
>>
>> On Wednesday, June 30, 2021 at 11:51:08 PM UTC+2 snide...@gmail.com
>> wrote:
>>
>>> If SQLFORM.process() accepts the form and does an insert, is there a
>>> variable the controller or view can use to get the id of the row inserted?
>>>
>>> I'm not spotting it in Chapter 7 nor in sqlhtml.py.
>>>
>>> /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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/182ad87d-380c-4e9e-888f-690ca22ade8dn%40googlegroups.com
> 
> .
>

-- 
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/CAHxJ-7rJboZvEzP1EjtGK2aZYxvnVSwqXzfJgXpHabJ%3DRCPxqg%40mail.gmail.com.


Re: [web2py] customizing SQLFORM

2020-03-18 Thread Javier Pepe
Change

db.posts.question by db.posts.message

El mié., 18 de mar. de 2020 a la(s) 10:24, Maurice Waka (
mauricew...@gmail.com) escribió:

> This is my code in the model.py
>
> db.define_table('posts',
> Field('author', 'reference auth_user',
> default=auth.user_id, writable=False, readable=False),
> Field("message", 'string', requires=IS_NOT_EMPTY(),
> length=512, label=T('questions'),widget=widget(_placeholder='Type your
> question here',)),
> auth.signature
> )
>
> On Wed, Mar 18, 2020 at 4:22 PM Maurice Waka 
> wrote:
>
>> I'm getting a none value. See attached.
>>
>> On Wed, Mar 18, 2020 at 4:14 PM Javier Pepe  wrote:
>>
>>> in the manual
>>>
>>> http://www.web2py.com/books/default/chapter/29/07/forms-and-validators#Custom-forms
>>>
>>> {{=form.custom.begin}}
>>> {{=form.custom.widget.question}}{{=form.custom.submit}}
>>> {{=form.custom.end}}
>>>
>>> El mié., 18 de mar. de 2020 a la(s) 10:09, Maurice Waka (
>>> mauricew...@gmail.com) escribió:
>>>
>>>> Thanks.
>>>> I put the code in the model.py code. It works.
>>>>
>>>> How about float button to right?
>>>>
>>>> Regards
>>>>
>>>> On Wed, Mar 18, 2020 at 4:00 PM Javier Pepe 
>>>> wrote:
>>>>
>>>>> Hi
>>>>>
>>>>> You can try with this
>>>>>
>>>>> db.posts.question.label = ' '
>>>>>
>>>>> label attr replace field name
>>>>>
>>>>>
>>>>>
>>>>> El mié., 18 de mar. de 2020 a la(s) 09:51, Maurice Waka (
>>>>> mauricew...@gmail.com) escribió:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I'm trying to customize the SQLFORM to look like
>>>>>> textarea/inputwith text area floating left and submit button to the
>>>>>> right and not bottom. I'm using the LOAD signature.
>>>>>>
>>>>>> I also want to hide the filed name (labelled as Questions see
>>>>>> attached).
>>>>>>
>>>>>> Currently with this code, I cant hide the field name and I cant find
>>>>>> a way to float the submit button to the right.
>>>>>>
>>>>>> Attached is how the form looks like.
>>>>>>
>>>>>> def post():
>>>>>> #db.posts.message.readable = False#Not working with this code
>>>>>> return dict(form=SQLFORM(db.posts, readable=False).process(),
>>>>>> posts=db(db.posts.author == auth.user.id).select() )
>>>>>>
>>>>>>
>>>>>> View page...post.load
>>>>>> 
>>>>>> {{=form}}
>>>>>> 
>>>>>>
>>>>>> --
>>>>>> 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/c8216348-8f12-4e8e-90c2-7e4ef9a482be%40googlegroups.com
>>>>>> <https://groups.google.com/d/msgid/web2py/c8216348-8f12-4e8e-90c2-7e4ef9a482be%40googlegroups.com?utm_medium=email_source=footer>
>>>>>> .
>>>>>>
>>>>> --
>>>>> 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 a topic in the
>>>>> Google Groups "web2py-users" group.
>>>>> To unsubscribe from this topic, visit
>>>>> https://groups.google.com/d/topic/web2py/m9jMXz52fZg/unsubscribe.
>>>>>

Re: [web2py] customizing SQLFORM

2020-03-18 Thread Javier Pepe
in the manual
http://www.web2py.com/books/default/chapter/29/07/forms-and-validators#Custom-forms

{{=form.custom.begin}}
{{=form.custom.widget.question}}{{=form.custom.submit}}
{{=form.custom.end}}

El mié., 18 de mar. de 2020 a la(s) 10:09, Maurice Waka (
mauricew...@gmail.com) escribió:

> Thanks.
> I put the code in the model.py code. It works.
>
> How about float button to right?
>
> Regards
>
> On Wed, Mar 18, 2020 at 4:00 PM Javier Pepe  wrote:
>
>> Hi
>>
>> You can try with this
>>
>> db.posts.question.label = ' '
>>
>> label attr replace field name
>>
>>
>>
>> El mié., 18 de mar. de 2020 a la(s) 09:51, Maurice Waka (
>> mauricew...@gmail.com) escribió:
>>
>>> Hello,
>>>
>>> I'm trying to customize the SQLFORM to look like textarea/inputwith
>>> text area floating left and submit button to the right and not bottom. I'm
>>> using the LOAD signature.
>>>
>>> I also want to hide the filed name (labelled as Questions see attached).
>>>
>>> Currently with this code, I cant hide the field name and I cant find a
>>> way to float the submit button to the right.
>>>
>>> Attached is how the form looks like.
>>>
>>> def post():
>>> #db.posts.message.readable = False#Not working with this code
>>> return dict(form=SQLFORM(db.posts, readable=False).process(),
>>> posts=db(db.posts.author == auth.user.id).select() )
>>>
>>>
>>> View page...post.load
>>> 
>>> {{=form}}
>>> 
>>>
>>> --
>>> 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/c8216348-8f12-4e8e-90c2-7e4ef9a482be%40googlegroups.com
>>> <https://groups.google.com/d/msgid/web2py/c8216348-8f12-4e8e-90c2-7e4ef9a482be%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> 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 a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/web2py/m9jMXz52fZg/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> web2py+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/web2py/CAHxJ-7oD-q_bewVyZbcViPAeKUx4kzy%2BMbCTbU%2B5_BA1a%2BSSew%40mail.gmail.com
>> <https://groups.google.com/d/msgid/web2py/CAHxJ-7oD-q_bewVyZbcViPAeKUx4kzy%2BMbCTbU%2B5_BA1a%2BSSew%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> 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/CALkNK540GAg23er7PmUbpKb1qefXQ-kYN_yikednYpFvt4jbiQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/web2py/CALkNK540GAg23er7PmUbpKb1qefXQ-kYN_yikednYpFvt4jbiQ%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
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/CAHxJ-7oprsPy_PvDWnGE8xhU9iuBcKN6462jaGouXKhY4qSuXw%40mail.gmail.com.


Re: [web2py] customizing SQLFORM

2020-03-18 Thread Javier Pepe
Hi

You can try with this

db.posts.question.label = ' '

label attr replace field name



El mié., 18 de mar. de 2020 a la(s) 09:51, Maurice Waka (
mauricew...@gmail.com) escribió:

> Hello,
>
> I'm trying to customize the SQLFORM to look like textarea/inputwith
> text area floating left and submit button to the right and not bottom. I'm
> using the LOAD signature.
>
> I also want to hide the filed name (labelled as Questions see attached).
>
> Currently with this code, I cant hide the field name and I cant find a way
> to float the submit button to the right.
>
> Attached is how the form looks like.
>
> def post():
> #db.posts.message.readable = False#Not working with this code
> return dict(form=SQLFORM(db.posts, readable=False).process(),
> posts=db(db.posts.author == auth.user.id).select() )
>
>
> View page...post.load
> 
> {{=form}}
> 
>
> --
> 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/c8216348-8f12-4e8e-90c2-7e4ef9a482be%40googlegroups.com
> 
> .
>

-- 
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/CAHxJ-7oD-q_bewVyZbcViPAeKUx4kzy%2BMbCTbU%2B5_BA1a%2BSSew%40mail.gmail.com.


Re: [web2py] Problem passing a json object to controller

2019-11-20 Thread Javier Pepe
You need use:

   var = json.loads ( request.post_vars.items[*"*json1*"*] )


El mié., 20 de nov. de 2019 a la(s) 14:08, Patito Feo (
patitofeo...@gmail.com) escribió:

> Hi,
>
> Ive been trying to pass an object with keys to the controller. But i
> havent been able to extract the request.vars.
>
> Here is my view:
>
> var Cars = {}
> Cars.make = 'Ford';
> Cars.model = 'Mustang';
> Cars.year = 1969;
>
> $.post( "{{=URL('default', 'transcriptor')}}", //request.post_vars.json1
>{
>  tarea: 'solicitudguardar', items: { json1: JSON.stringify( Cars )
> }
>}, )
>
>
> Here is my function:
>
> elif request.vars.tarea == 'solicitudguardar':
>
>var = json.loads ( request.post_vars.items[json1] )
>
>
>
> Here is one of the errors i got:
>
> global name 'json1' is not defined
>
>
> I dont understand why the array object is not being process as a json
> array in controller.
>
> Any help will be much appreciated.
>
>
> Cheers,
>
> --
> 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/cb71d997-01f3-4dd3-b689-35c280e035b7%40googlegroups.com
> 
> .
>

-- 
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/CAHxJ-7pDW9q03HMwjcOzc6JWovRTLTDTZ3S5o32rYG8JfUb8tw%40mail.gmail.com.


Re: [web2py] Re: Changing color of a cell function of another cell value

2018-11-22 Thread Javier Pepe
You can try this way

db.articles.conteneur.represent = lambda cntnumok, row: SPAN*(*row[
'conteneur'], _class='cnt-false'*)* if cntnumok==False and cntnumok else
None

Check parenthesis


El mié., 21 de nov. de 2018 a la(s) 07:42, Yann Dulondel (
yann.dulon...@gmail.com) escribió:

>
>
> Le mercredi 21 novembre 2018 10:51:16 UTC+1, Yann Dulondel a écrit :
>>
>> Hi all,
>> I have a container number and a function that check the number is valid.
>> The result of the function is store in field cntnumok (boolean).
>> I found that we can change the color with "represent" and found an
>> example in webgroup.
>>
>> db.articles.conteneur.represent = lambda v, row: SPAN(v, _class=
>> 'cnt-false' if db.articles.cntnumok==False else None)
>> I understand lambda is an inline function, i want that the if test the
>> value of  "cntnumok" for the row
>> How can i have the value of  "cntnumok"  for the row?
>> I tried this also
>> db.articles.conteneur.represent = lambda v, row:
>> SPAN(v,_class='cnt-false' if row.cntnumok==False else None)
>>
>> Try this
> db.articles.conteneur.represent = lambda cntnumok, row:SPAN(row[
> 'conteneur'], _class='cnt-false' if cntnumok==False and cntnumok else None
> )
>
> No error message but the color doesn't change
>
>> Yann
>>
> --
> 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] Connect DAL to Azure Postgres Instance

2018-09-28 Thread Javier Pepe
Try this:

db = DAL("postgres://xw@dbname-postgres:
p...@dbname-postgres.postgres.database.azure.com/dbname")

El vie., 28 de sep. de 2018 a la(s) 02:17, gb (gregb...@gmail.com) escribió:

> Trying to connect to Azure-hosted postgres on version
> 2.17.1-stable+timestamp.2018.08.06.01.02.56
>
> If I try and connect with:
>
> db = DAL("postgres://dbname@dbname-postgres:
> p...@dbname-postgres.postgres.database.azure.com/dbname")
>
> I get this:
> Invalid URI string in DAL
>
> I thought it might have to do with the @ so I encoded it:
>
> db = DAL("postgres://
> dbname%40dbname-postgres:p...@dbname-postgres.postgres.database.azure.com/dbname
> ")
>
> OperationalError: could not create SSL context: library has no ciphers
> FATAL: Invalid Username specified. Please check the Username and retry
> connection. The Username should be in  format.
>
> Connecting like this works totally fine:
> import psycopg2
>
> conn = psycopg2.connect("dbname='dbname' user='xw@dbname-postgres' host='
> dbname-postgres.postgres.database.azure.com' password='pass'")
>
> cur = conn.cursor()
>
>
> Any ideas?
>
> Thanks so much
>
> --
> 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] Setting writable and readable=True on all fields

2018-09-27 Thread Javier Pepe
You need use the follow code:
for f in my_table.fields():
db['my_table'][f].writable=True



El jue., 27 de sep. de 2018 a la(s) 19:01, icodk (i...@alpiron.com) escribió:

> At a certain point, I need to allow read and write on all fields of a
> specific table
>
> How can I iterate through all fields in a table and set the writable,
> readable =true
>
> This does not work:
> for f in my_table.fields():
>f.writable=f.readable=True
>
>
>
> --
> 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] CUSTOMIZING WEB2PY FORMS

2018-09-07 Thread Javier Pepe
In docs you have example.

http://web2py.com/books/default/chapter/29/07/forms-and-validators#Custom-forms

El vie., 7 de sep. de 2018 a la(s) 07:02, elisha bere (elishabe...@gmail.com)
escribió:

> Hie guys,
>
> how do i customize the buttons on the forms if i add =form to my web page?
>
> --
> 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 IS_NOT_EMPTY validator dependent on the value of another request vara

2018-01-15 Thread Javier Pepe
Hi

You can use de conditional show_if

http://web2py.com/books/default/chapter/29/07/forms-and-validators#Conditional-fields

db,table.text_field.show_if = (db.table.select_field == Other)




2018-01-12 23:19 GMT-03:00 vtcpe12 :

> Hi,
>
> I am utilizing the IS_IN_SET functionality to produce a select box in my
> SQLFORM. One of the options is 'Other'. I have another simple text box that
> I would like to force the user to enter a value for if Other is selected in
> the select box. Is that possible with the built in validators?
>
> 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.
>

-- 
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] Open a form (form=SQLFORM(db.marks)) for a selected person by clicking on a link of their name

2017-10-22 Thread Javier Pepe
Hi

You can fill the record before SQLFORM

def marks_entry():
stu=db.student(request.args(0))

*db.marks.students.default = stu.id *
form=SQLFORM(db.marks)
return locals();

2017-10-22 8:59 GMT-03:00 mostwanted :

> Hi guys, i need help, I'm creating a simple results management system for
> a school and I've hit a stumbling block, what i wanna do is be able to open
> a form to make detail entries of a specific individual and this is how i
> want to do it, i wanna click on the specific individual's name and have
> that form open up with the name of that person pre-selected so i don't have
> to go through a large list of too many students looking for one student &
> have other fields empty and all i have to do is fill up those fields,
> fields like marks for the subjects. PLEASE HELP, I'M REALLY STUCK!
>
> My application is straight forward and to the point and so is its code:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *MODELSdb.define_table('student_class',Field('class_name',
> requires=IS_NOT_EMPTY()),Field('teacher', 'reference
> teacher'),
> format='%(class_name)s')db.define_table('student',
> Field('surname', requires=IS_NOT_EMPTY()),Field('name',
> requires=IS_NOT_EMPTY()),Field('photo', 'upload',
> requires=IS_NOT_EMPTY()),Field('class_name', 'reference
> student_class'),Field('dob', 'date',
> requires=IS_NOT_EMPTY()),
> format='%(surname)s')db.define_table('subject',
> Field('subject_name', requires=IS_NOT_EMPTY()),
> format='%(subject_name)s')#I WANT THIS TABLE TO BE OPEN WHEN I CLICK ON A
> NAME BUT WITH THAT NAME AND PRE-SELECTED WITH ONLY SOME FIELDS LEFT EMPTY
> SO I DONT #HAVE TO GO THROUGH A LIST OF 100 LOOKING FOR ONE
> STUDENT.db.define_table('marks',Field('student', 'reference
> student'),Field('subject', 'reference
> subject'),Field('term',
> requires=IS_NOT_EMPTY()),Field('marks', 'integer',
> requires=IS_NOT_EMPTY()),Field('total', 'integer',
> requires=IS_NOT_EMPTY()),
> Field('comments',type='text',requires=IS_NOT_EMPTY()),
> )CONTROLLERdef student_class():
> classes=db.student_class(request.args(0))
> student=db(db.student.class_name==classes.id
> ).select(orderby=db.student.surname)
> head=db(db.letter_head).select(db.letter_head.ALL)return
> locals()VIEWCLASS:
> {{=classes.class_name}} style="margin-left: 15px;">SURNAMES (A-E){{letters=['A', 'B',
> 'C', 'D', 'E', 'F']for stu in student:if stu.surname[0] in
> letters:stu.surname}}{{=A('Report', _href=URL('genrate_report',
> args=stu.id ))}} |  class="name">{{=stu.surname}} | {{=A('Marks',
> _href=URL('marks_entry', args=stu.id ))}} />{{pass}}{{pass}}CONTROLLER*
>
>
>
>
>
>
>
>
>
> *#I DO NOT KNOW WHAT TO ENTER IN THE BELOW FUNCTION TO MAKE IT DO WHAT I
> WANT IT TO DOdef marks_entry():form=SQLFORM(db.marks)return
> locals();VIEW{{extend 'layout.html'}}{{=form}}*
>
> --
> 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: how to create pdf report in web2py???

2017-08-29 Thread Javier Pepe
Alex

The tool is very good, you have a user list for question, i am to try the
designer and not found howto save this.

Thanks

2017-08-26 10:19 GMT-03:00 Alex :

> We created a report tool since creating pdf reports in a web application
> is a common problem and none of the existing solutions were optimal for us.
> We needed something that is easy to integrate, easy to use (to design the
> reports) and easy to maintain (e.g. to create new versions of an existing
> report template).
>
> https://www.reportbro.com
>
> The designer to create report templates is a javascript plugin which can
> easily be integrated in a web application. Server-side we developed a
> python package - which you can either download or install via pip - to
> create the pdf (or xlsx) file with a given report template and data.
> Because it's python it is easy to use in an existing web2py app.
>
> We appreciate any kind of feedback!
>
> 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] SQLFORM.GRID Change Header and labels too?

2017-04-07 Thread Javier Pepe
Hi

You can use de label atribute in Field definition, this used in all forms.


   - label is a string (or a helper or something that can be serialized to
   a string) that contains the label to be used for this field in
   auto-generated forms.

http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Field-constructor


2017-04-07 13:38 GMT-03:00 r :

> So I have changed the header for my sqlform grid:
>
> grid = SQLFORM.grid(db.adminis,headers={'adminis.Name':'Name'
> ,'adminis.Description':'Description','adminis.Rating':'Average Rating'})
>
> and when I click on view/edit I would like the same labels to be used. How
> is it possible ?
>
>
> --
> 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] Grid

2017-01-24 Thread Javier Pepe
Hi

You can use selectable metod to pass selected row to a function to update
records.



El sáb., 21 ene. 2017 a las 12:05, Bishal Saha ()
escribió:

> Cant we use grid to update few rows ?
>
> --
> 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] How to define tables in a new model file

2016-05-11 Thread Javier Pepe
Hi

Web2py load files in alphabet orden.  You need rename files for load in
correct order.
For example:
Db.py as 00_db.py
Data.py as 01_data.py

El dom., 8 de mayo de 2016 10:48, Simon Carr 
escribió:

> I created a new model and called it data.py
>
> I created a definition for a table
>
> db.define_table('suppliers',
> Field('company_name','string'),
> Field('address1','string'),
> Field('address2','string'),
> Field('town','string'),
> Field('county','string'),
> Field('country','string'),
> Field('postcode','string'),
> Field('telephone','string'))
>
> But I get the error that db is not defined.
>
> I thought db was already defined by db.py
>
> --
> 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] Changing color of field

2016-04-21 Thread Javier Pepe
Hello

If you use bootstrap, can change the class of field

http://getbootstrap.com/css/#helper-classes-backgrounds



On Thu, Apr 21, 2016 at 9:39 AM, Md Anam Raihan 
wrote:

> I am creating task management app and i want to change color of field if
> deadline is completed then how to do it using javascript also i am facing
> problem in extracting datetime from my field??
>
> --
> 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: Using tinymce for text areas of in component views

2016-02-17 Thread Javier Pepe
Hello

This work for me:

Controller:
def textarea():
form=FORM('Texto:',
  TEXTAREA(_name='texto',
requires=IS_NOT_EMPTY(),_id='mytextarea'),
  INPUT(_type='submit'))
return locals()

View:


  
  tinymce.init({
selector: '#mytextarea'
  });
  
{{extend 'layout.html'}}
{{=form}}
~

On Wed, Feb 17, 2016 at 10:05 AM, PRACHI VAKHARIA 
wrote:

>
>
>- Can you please post your codes for making TinyMCE work with web2py
>Components?
>- It will allow to get a better understanding of how you applied it
>within web2py Components.
>
> Thanks!
>
> *— PRACHI*
>
>
>
>
> On Saturday, 6 November 2010 01:29:25 UTC-4, Luther Goh Lu Feng wrote:
>>
>> I am putting this link here
>> http://tinymce.moxiecode.com/punbb/viewtopic.php?id=28
>> as this is the solution to problematic form submissions.
>>
>> tinyMCE.triggerSave() might need to be called if you are using ajax or
>> components for your form submission. Hope this will be useful to
>> someone who searches the group.
>>
> --
> 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] charts on web2py

2016-01-20 Thread Javier Pepe
Hi

For simple charts you can use google chart, exist plugin for integrate this

http://www.web2pyslices.com/slice/show/1721/google-charts-plugin



On Wed, Jan 20, 2016 at 3:09 PM, Richard Vézina  wrote:

> Do you know that plotly was open sourced : https://plot.ly/
>
> I it one of your best choice if you want something dynamic... There is
> D3.js, but I remember having read that most of it is included in the plotly
> stack...
>
> Richard
>
> On Wed, Jan 20, 2016 at 11:04 AM, Diego Tostes 
> wrote:
>
>> 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.
>>
>
> --
> 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] Showing menu only after successful login

2015-02-10 Thread Javier Pepe
Also you can try to verify the model (menu.py) that the user is logged before
loading the array with the options menu
if auth.is_logged_in ():
 response.menu = [options ]
else:
 response.menu = []

On Tue, Feb 10, 2015 at 5:26 PM, Richard Vézina ml.richard.vez...@gmail.com
 wrote:

 You can create a layout_login.html and remove what you want...

 In views/default/user.html replace layout.html by your layout_login.html

 That it!

 Richard

 On Tue, Feb 10, 2015 at 9:13 AM, Simon Marshall spike.hac...@gmail.com
 wrote:


 Hi All,

 is there a way to hide the top menu until a person has logged in, i have
 a requirement that present a user just with a login page before the can do
 anything on the site.

 Any suggestion or pointer would be grateful.

 Thanks

 Simon

 --
 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] grid problem

2014-07-29 Thread Javier Pepe
form = SQLFORM.grid(db.t_proposte,
   searchable=True,
  deletable=True,
   details=False,
*   selectable**=True,** - must be a function*
   csv=True,
  user_signature=False)  # change to True in production


On Tue, Jul 29, 2014 at 12:05 PM, ceriox cer...@gmail.com wrote:

 hi all,
 i have a table with some fields (two of the type boolean)

 if i use
 form = SQLFORM.smartgrid(db.t_proposte,onupdate=auth.archive)


 all work fine!

 but if i use:
 form = SQLFORM.grid(db.t_proposte,
searchable=True,
   deletable=True,
details=False,
selectable=True,
csv=True,
   user_signature=False)  # change to True in
 production


 i have the error:
 type 'exceptions.TypeError' 'bool' object is not iterable
 i'm doing something wrong?
 (i don't have any type of requires on the fields)

  --
 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] how to turn off the record counter on Sqlform.grid

2014-06-26 Thread Javier Pepe
I'm use this code:

form = SQLFORM.grid()
form.element('.web2py_counter',replace=None)


On Thu, Jun 26, 2014 at 2:04 AM, JorgeH jorgeh...@gmail.com wrote:

 hello
 Is it possible to turn off the record counter , on the top right of the
 table generated by sqlform.frid ??

 --
 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: Cron job every 30 seconds

2013-11-28 Thread Javier Pepe
You can add cron job which sleep

* * * * * sleep  0;/usr/local/apps/web2py/applications/sipacweb/private/run
procesos.py
* * * * * sleep 10;/usr/local/apps/web2py/applications/sipacweb/private/run
procesos.py
* * * * * sleep 20;/usr/local/apps/web2py/applications/sipacweb/private/run
procesos.py
* * * * * sleep 30;/usr/local/apps/web2py/applications/sipacweb/private/run
procesos.py
* * * * * sleep 40;/usr/local/apps/web2py/applications/sipacweb/private/run
procesos.py
* * * * * sleep 50;/usr/local/apps/web2py/applications/sipacweb/private/run
procesos.py

This process run every ten seconds.





On Wed, Nov 27, 2013 at 11:20 PM, Brian M bmere...@gmail.com wrote:

 web2py's scheduler will let you set the repeat period in seconds so you
 could probably do 30 seconds that way.

 On Tuesday, November 26, 2013 2:55:16 PM UTC-6, melmg wrote:

 Is is possible to set up a cron job to run every 30 seconds instead of a
 minute? I have a function that does an HTTP GET request to retrieve some
 values from another server (a small server running on a microcontroller)
 and then saves those values in the database. I want to run this function
 every 30 seconds in the background.

 Thank you for the 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/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: simple button in grid question

2013-09-16 Thread Javier Pepe
You need pass a list of dict

links = [{'header':'', 'body': lambda row:
A('',_title='Procesar',_class='icon-refresh',_href=URL(c='planilla',
  {'header':'', 'body': lambda row:
A('',_title='Mail',_class='icon-envelope',_href='index/pedircontadores/%
  {'header':'', 'body': lambda row:
A('',_title='Estado',_class='icon-ok',callback=URL(c='planilla',f='estad
  {'header':'', 'body': lambda row:
A('',_title='Control',_class='icon-check',_href=URL(c='planilla',f='pdf/
  {'header':'', 'body': lambda row: A('',_title='Control
2',_class='icon-check',_href=URL(c='planilla',f='co
  {'header':'', 'body': lambda row:
A('',_title='PDF',_class='icon-print',_href=URL(f='pdf/%s/%s' % (row.id,
  {'header':'', 'body': lambda row: A('',_title='PDF
distribuidor',_class='icon-print',_href=URL(f='pdf/%s/%
  {'header':'', 'body': lambda row:
A('',_title='Detalle',_class='icon-list',_href=URL(c='detalle',f='index'
  ]



On Sun, Sep 15, 2013 at 9:31 PM, Alex Glaros alexgla...@gmail.com wrote:

 What is syntax for TWO or more  buttons? I've tried several variations.
 Would it be two dict phrases, or two header phrases separated by commas?

 One button will call one function, and the other would call a different
 function.

 thanks,

 Alex


 On Saturday, September 14, 2013 6:56:24 PM UTC-7, Alex Glaros wrote:

 Works perfect Adi and Villas,

 much appreciated.

 Here's the complete code:

 def view_all_suggestions_and_**comments():
 query = (db.IdeaComment.ideaID==db.**Idea.id http://db.Idea.id) 
 (db.IdeaComment.partyID==db.**Party.id http://db.Party.id)
grid = SQLFORM.grid(query, ,links = [dict(header='Virtual Field',
  body=lambda row: A('Add a comment!',_class=btn btn-mini,
 _href=URL('comment_on_a_**suggestion', vars=dict(filter=row.Idea.id))**
 ))])
 return dict(grid = grid)

 Alex


 On Saturday, September 14, 2013 6:01:33 PM UTC-7, Adi wrote:

 lambda row: A('Complete',
 _class='btn', _id='btn_complete',
 _onclick='return confirm(Complete
 Order %s? (%s %s))' % (row.id,

row.shipFirstName,

row.shipLastName),
 _href=URL(r=request,f='**
 complete_order',args=[row.id])**,




 On Saturday, September 14, 2013 7:41:24 PM UTC-4, Alex Glaros wrote:

 it works correctly Villas, thanks.

 how could I turn Add a comment! text into a button.  Possible syntax
 ,_class=btn btn-mini, but where does it go?

 thanks,

 Alex

 On Saturday, September 14, 2013 10:23:00 AM UTC-7, villas wrote:

 Maybe this would work using row.idea.id like this...

 grid = SQLFORM.grid(query,
 links = [dict(header='Virtual Field',
 body=lambda row: A('Add a comment!', _href=URL('comment_on_a_**
 suggestion', vars=dict(filter=row.idea.id http://row.id/))**)
 )]
 )


 You can also now include virtual fields in grids,  but I haven't
 needed to try that yet.



 On Saturday, 14 September 2013 15:23:49 UTC+1, Alex Glaros wrote:

 thanks Villas but I receive this error: Row' object has no attribute
 'id'

 perhaps it doesn't know which of the joined ids to reference

 this work-around works because it let's system know which id it is:
   db.Idea.id.represent = lambda id, r: A('Add a comment!',
 _href=URL('comment_on_a_sugges**tion', vars=dict(filter=id)))

 Alex

 On Saturday, September 14, 2013 4:56:33 AM UTC-7, villas wrote:

 Try this...

 grid = SQLFORM.grid(query,
   **   links = [dict(header='Virtual
 Field',
   ** body=lambda
 row: A('Add a comment!', _href=URL('comment_on_a_**suggestion',
 vars=dict(filter=row.id)))
   **  )]
   **  )


 On Friday, 13 September 2013 21:57:28 UTC+1, Alex Glaros wrote:

 I tried this but got lambda requires 2 args, 1 given error, plus
 need to be able to pass Idea.id parm to the button.  How to do that?

 grid = SQLFORM.grid(query,links = [dict(header='Virtual
 Field',body=lambda id, r: A('Add a comment!', _href=URL('comment_on_a_
 **suggestion', vars=dict(filter=id])

 On Friday, September 13, 2013 1:33:35 PM UTC-7, villas wrote:

 Hope this helps...

 From the book:

 links is used to display new columns which can be links to other
 pages. The links argument must be a list of 
 dict(header='name',body=lambda
 row: A(...)) where header is the header of the new column and bodyis 
 a function that takes a row and returns a value. In the example, the
 value is a A(...) helper.

 Example:

 linkbtns = [
  lambda row: SPAN('Mag',_class=label
 label-success) \
   if row.status =='Y' else '',
  lambda row: SPAN('Web',_class=label
 label-success) \
   if row.is_active else '',
  lambda row: 

Re: [web2py] Re: web2py 2.6.1 is OUT - IMPORTANT READ

2013-09-13 Thread Javier Pepe
+1


On Fri, Sep 13, 2013 at 5:56 AM, Tim Richardson t...@growthpath.com.auwrote:

 I've been using it for about a month on one Windows production site with
 ms-sqlserver, and it's a great release. So many improvements and even more
 fun to use. 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/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: web2py 2.6.1 is OUT - IMPORTANT READ

2013-09-13 Thread Javier Pepe
I'm try to use new version, but missing settings.cfg file.

In that directory has to put it and what format must have?

Thansk


On Fri, Sep 13, 2013 at 8:40 AM, Javier Pepe javierp...@gmail.com wrote:

 +1


 On Fri, Sep 13, 2013 at 5:56 AM, Tim Richardson t...@growthpath.com.auwrote:

 I've been using it for about a month on one Windows production site with
 ms-sqlserver, and it's a great release. So many improvements and even more
 fun to use. 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/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: web2py 2.6.1 is OUT - IMPORTANT READ

2013-09-13 Thread Javier Pepe
Now work

The update from admin interface not end correctly.

Unzip file over actual folder, restart and work!!!





On Fri, Sep 13, 2013 at 8:49 AM, Javier Pepe javierp...@gmail.com wrote:

 I'm try to use new version, but missing settings.cfg file.

 In that directory has to put it and what format must have?

 Thansk


 On Fri, Sep 13, 2013 at 8:40 AM, Javier Pepe javierp...@gmail.com wrote:

 +1


 On Fri, Sep 13, 2013 at 5:56 AM, Tim Richardson 
 t...@growthpath.com.auwrote:

 I've been using it for about a month on one Windows production site with
 ms-sqlserver, and it's a great release. So many improvements and even more
 fun to use. 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/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] Load every 5 seconds

2013-08-30 Thread Javier Pepe
Hi

I need load SQLFOM.grid every 5 seconds, try whith autorefresh, but load
all page.

I need help to create javascript to load only a SQLFROM.grid.

Thanks

-- 

--- 
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: Load every 5 seconds

2013-08-30 Thread Javier Pepe
Thanks

works better than expected


On Fri, Aug 30, 2013 at 2:53 PM, Paolo Valleri paolo.vall...@gmail.comwrote:

 Have a look at
 http://web2py.com/books/default/chapter/29/12/components-and-plugins#Components
 Paolo

 On Friday, August 30, 2013 7:50:10 PM UTC+2, Javier Pepe wrote:

 Hi

 I need load SQLFOM.grid every 5 seconds, try whith autorefresh, but load
 all page.

 I need help to create javascript to load only a SQLFROM.grid.

 Thanks



  --

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


-- 

--- 
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] Any way of removing the text from Grid buttons?

2013-08-29 Thread Javier Pepe
Is simple

SQLFORM.grid(query,showbuttontext=False)


On Wed, Aug 28, 2013 at 8:19 PM, greenpoise danel.sega...@gmail.com wrote:

 is there a way to remove the text from grid buttons? I mean the stock ones
 (View, Edit, Delete)

 --

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


-- 

--- 
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: Change form layout

2013-06-24 Thread Javier Pepe
You can try whith:

http://dev.s-cubism.com/plugin_solidform


On Mon, Jun 24, 2013 at 12:02 PM, Tom Russell t...@caregointl.com wrote:

 Ah, I see now.

 Thanks


 On Mon, Jun 24, 2013 at 10:50 AM, Anthony abasta...@gmail.com wrote:

 No, 3 columns means:

 Col 1   Col 2 Col 3
 label   widget   comment

 It's still one field per row. When in doubt, try it out. :-)

 Anthony


 On Monday, June 24, 2013 10:26:08 AM UTC-4, Tom Russell wrote:

 Thanks again for the info.

 I guess I still do not get it though if I set my formstyle to table3cols
 would'nt my form at least be laid out like:

 Name Address City
 State

 Or am I not looking at this correctly?


 On Mon, Jun 24, 2013 at 10:16 AM, Anthony abas...@gmail.com wrote:

 Your best bet is to look at how the built-in ones work, starting here:
 https://code.google.com/**p/web2py/source/browse/gluon/**sqlhtml.py#752https://code.google.com/p/web2py/source/browse/gluon/sqlhtml.py#752.
 Copy the one of those that is closest to what you want and modify it as
 necessary.

 def myformstyle():
 [custom code here]

 form = SQLFORM(..., formstyle=myformstyle)

 Anthony


 On Monday, June 24, 2013 10:07:49 AM UTC-4, Tom Russell wrote:

 Thanks for the responses.

 The formstyle looks interesting but I cannot make heads or tails out
 of the way to use it. Are there any examples of this some place?

 Thanks


 On Mon, Jun 24, 2013 at 9:55 AM, Anthony abas...@gmail.com wrote:

 I assume that means you are relying on a generic view to display your
 table. If so, you can instead create a non-generic view (which you should
 probably do anyway), or you can build the form DOM on the server using
 web2py HTML helpers (probably not the way to go). The custom formstyle
 option also does not require any HTML coding.

 Anthony


 On Monday, June 24, 2013 9:35:31 AM UTC-4, Tom Russell wrote:

 Thanks for the response. So now I am really confused because I have
 no idea where to put this code if I am using a SQLFORM.factory?

 Basically I just want to add row fluid to make the layout a little
 easier to navigate. I do not have a html file to set this code in for 
 this
 form.

 Thanks.


 On Mon, Jun 24, 2013 at 9:04 AM, Anthony abas...@gmail.com wrote:

 http://web2py.com/books/**default/chapter/29/07#Custom-**formshttp://web2py.com/books/default/chapter/29/07#Custom-forms

 I don't think it's in the book yet, but you can also create a
 custom formstyle if you need to use the layout in multiple places:
 https://groups.google.**com/d/msg/web2py/QmoRmapiOwA/**t
 ZqeEbii6QgJhttps://groups.google.com/d/msg/web2py/QmoRmapiOwA/tZqeEbii6QgJ

 Anthony


 On Monday, June 24, 2013 8:53:16 AM UTC-4, Tom Russell wrote:

 I have a SQLForm and use the formset DIV for it but its not what I
 really want. Rather than having just one column with all of the fields
 required to be filled out, how do I set it so its like 3-4 columns?

 For example:

 Name  Address  City  State

 Instead of:

 Name
 Address
 City
 State

 Thanks.

  --

 ---
 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/**grou
 ps/opt_out https://groups.google.com/groups/opt_out.




  --

 ---
 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/**grou**ps/opt_outhttps://groups.google.com/groups/opt_out
 .




  --

 ---
 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_outhttps://groups.google.com/groups/opt_out
 .




  --

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




  --

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




-- 

--- 
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] SQLFROM.GRID SELECTEBLE

2013-05-10 Thread Javier Pepe
Hi

you have to use

selectable = lambda ids: function(ids)

def function(ids):
...
...
...


On Fri, May 10, 2013 at 9:14 AM, Pawan Jha pawan.pan...@agnicient.comwrote:

 Hi I am new developer with Web2py so getting problem to work on so please
 help


 I'm using selectable=True in the sqlform.grid. This shows a checkbox in
 first column for all the rows except the header and Submit Button

 i want to get all the Selected check box id on clicking on submit button
 



  --

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




-- 

--- 
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] REF: Pie/bar Charts

2013-04-04 Thread Javier Pepe
Hello

I am use http://pygooglechart.slowchop.com/

Is very simple, create a file, a use then in the view.




On Thu, Apr 4, 2013 at 10:37 AM, Teddy Nyambe software@gmail.comwrote:

 whats the easiest way to create a pie/bar chart using web2py/python, i was
 attempting to use pycha with cairo/pycairo libraries with very little
 success, failed to install pycairo on the mac all the googled exmaples not
 working.

 Any ideas?

 --

 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

 --

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




-- 

--- 
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] Smartgrid: How to make value from foreign table appear in table when only foreign key is in table

2013-02-22 Thread Javier Pepe
Alex

Use represent for this:

http://web2py.com/books/default/chapter/29/06#Record-representation

Ej:

db.Word.dictionaryTipeID.represent = lambda id,row: db.DictionaryType
(id).dictionaryName




On Thu, Feb 21, 2013 at 10:35 PM, Alex Glaros alexgla...@gmail.com wrote:

 Instead of *db.Word.dictionaryTypeID* displaying (which is a foreign key
 in db.Word), I’d like a value from the foreign table to appear, i.e.,
 DictionaryType. dictionaryName.


 In the example below, when user cascades down to the Word table, it only
 shows db.Word.dictionaryTypeID but I’d like to add the corresponding
 DictionaryType. dictionaryName value to it.


 def search_lang():

grid = SQLFORM.smartgrid(db.HumanLanguage,
 linked_tables=['Word','DictionaryType'], fields = [db.HumanLanguage.id,
 db.HumanLanguage.languageName, db.Word.id, db.Word.wordName,
 db.Word.definition, db.DictionaryType.dictionaryName,

*db.Word.dictionaryTypeID*],

user_signature=False)

return dict(grid=grid)


 idhttp://127.0.0.1:8000/tech_dictionary/default/search_lang/HumanLanguage/Word.languageID/1?keywords=order=Word.id
   
 Wordnamehttp://127.0.0.1:8000/tech_dictionary/default/search_lang/HumanLanguage/Word.languageID/1?keywords=order=Word.wordName
   
 Definitionhttp://127.0.0.1:8000/tech_dictionary/default/search_lang/HumanLanguage/Word.languageID/1?keywords=order=Word.definition
   
 Dictionarytypeidhttp://127.0.0.1:8000/tech_dictionary/default/search_lang/HumanLanguage/Word.languageID/1?keywords=order=Word.dictionaryTypeID
 1 beakerglass jar 1


 Want to replace the 1 under Dictionarytypeid with value from foreign
 table.

 Thanks,

 Alex Glaros

  --

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




-- 

--- 
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] SQLFORM.grid and the maxtextlength parameter: The parameter doesnt work in my code

2013-01-18 Thread Javier Pepe
Hello

maxtextlength is for all fields, you need use maxtextlengths

http://web2py.com/book/default/chapter/07#SQLFORM.grid-and-SQLFORM.smartgrid


On Fri, Jan 18, 2013 at 9:40 AM, Sverre sverreodeg...@gmail.com wrote:

 I have the controller:

 def commodities():
 tbl = db.commodities
 fields = [tbl.itemcode,tbl.name,tbl.unit,tbl.supplier,tbl.contact]
 query = (tbl.id0)
 order = [tbl.itemcode]
 maxlen = {'commodities.itemcode':2,'commodities.name
 ':2,'commodities.unit':2,'commodities.supplier':2,'commodities.contact':2}
 return dict(grid=SQLFORM.grid(query,fields=fields, csv=False,
 orderby=order,maxtextlength=maxlen))


 The grid is working well, but not the maxtextlength parameter. If I set
 the parameter to 2, it's working but not when I'm setting all field
 individually. Has someone an idea?




  --





-- 





Re: [web2py] Smartgrid orderby field , descending

2013-01-09 Thread Javier Pepe
Use this:

orderby=~db.table.date


On Wed, Jan 9, 2013 at 7:08 AM, António Ramos ramstei...@gmail.com wrote:

 hello, how do i order a smartgrid based on a field in descending order?
 for example the auth event table on date descending

 thank you

 --





-- 





Re: [web2py] Re: Need to save a multipage PDF

2012-11-21 Thread Javier Pepe
Try this:

def taggen_print():
*pdf = FPDF()*
rows = db(db.bike_no.id  0).select()
for row in rows:
   tag_no = row.bike_typ+str(row.id)
   pfile = tag_no+'_p.pdf'
   pdf.add_page()
   pdf.set_font('Arial', 'B', 14)
   pdf.cell(40,10,tag_no)
*   pdf.AddPage()*
*pdf.output(name=request.folder + '/static/temp.pdf')*
response.headers['Content-Disposition']='attachment.filename =' + pfile
response.headers['Content-Type']='application/pdf'
return response.stream(open(request.folder+'/static/temp.pdf',
'rb'),chunk_size=4096)
#  pdf.output(pfile, 'F')
redirect(URL(index))


On Wed, Nov 21, 2012 at 5:18 AM, LightDot light...@gmail.com wrote:

 This group is a wealth of information for other users, so when you can,
 please do post what is it that you've figured out. :)

 It's highly likely someone will have the same or similar problem and
 search for answers.

 Regards,
 Ales


 On Wednesday, November 21, 2012 6:36:04 AM UTC+1, Paul Rykiel wrote:

 Nevermind ... figured it out
 On Tuesday, November 20, 2012 3:06:22 PM UTC-6, Paul Rykiel wrote:

 Greetings everyone,

 this is my code and I am having difficulity creating a Multipage PDF
 to save to a directory.
 any assistance will be welcomed.

 Regards,

 def taggen_print():
 rows = db(db.bike_no.id  0).select()
 for row in rows:
tag_no = row.bike_typ+str(row.id)
pfile = tag_no+'_p.pdf'
pdf = FPDF()
pdf.add_page()
pdf.set_font('Arial', 'B', 14)
pdf.cell(40,10,tag_no)
pdf.output(name=request.folder + '/static/temp.pdf')
 response.headers['Content-**Disposition']='attachment.**filename ='
 + pfile
 response.headers['Content-**Type']='application/pdf'
 return response.stream(open(request.**folder+'/static/temp.pdf',
 'rb'),chunk_size=4096)
 #  pdf.output(pfile, 'F')
 redirect(URL(index))

 right now it only saves the PDF for the last record... I need it to
 create a page for each record and save it in PDF format in the directory

  --





-- 





Re: [web2py] SQLFORM.grid dinamically update fields

2012-10-03 Thread Javier Pepe
chech this

http://web2py.com/books/default/chapter/29/07?search=onupdate

may help.





On Wed, Oct 3, 2012 at 9:49 PM, alex a22...@gmail.com wrote:


 I have a SQLFORM.grid.
 When the user updates field 'a' in the grid, before submitting the form,
 field 'b' should represent a calculation based on value of 'a'.
 For instance b=a+1

 db.py
 db.define_table('t',
 Field('a', type='integer'),
 Field('b', type='integer')
 )

 default.py
 def index():
 grid = SQLFORM.smartgrid(db.t)
 return locals()

 index.html
 {{extend 'layout.html'}}
 {{=grid}}

 Someone can help?

 --





-- 





Re: [web2py] Re: Calculated field in SQLFORM.grid

2012-10-01 Thread Javier Pepe
Hello

You can create a function to represent in link

links =  [{'header':'Contador', 'body': lambda row: count_b(row.id) }]


def count_b(a.id):
c = db(db.B.ref_a == id).count()
if c:
count = c
else:
count = 0
return count

On Sun, Sep 30, 2012 at 9:26 AM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 This is currently not possible unless you denormalize and store the count
 in a column of A.


 On Saturday, 29 September 2012 23:01:22 UTC-5, alex wrote:


 I have a relation  [1:n] from table A to table B.

 define_table('A',
  Field('name', type='string'))

 define_table('B',
  Field('ref_a', type='reference A'))



 Then I have this grid

 qry = db.A.id0
 grid = SQLFORM.grid(qry,links=links)

 How do I write links (and the lambda function in it) in order to have in
 the grid an additional column with the count of references to A
 (db.B.ref_a.count()) ?

  --





-- 





Re: [web2py] Re: bootstrap and user panel

2012-07-24 Thread Javier Pepe
Hello

Delete the content on database dir.
The system recreate auth tables.



On Tue, Jul 24, 2012 at 2:49 AM, murtaza52
murtaza.hus...@sevenolives.comwrote:


 Hello Martin,

 The CSS is cool so +1 for this.

 1) I cloned your welcome app repo and placed it under applications, this
 is the summary of the error I get when I browse to the app -

 127.0.0.1.2012-07-24.11-12-36.3a36305c-435d-4087-ab03-e427b4e00812
 class 'sqlite3.OperationalError' table auth_user already exists

 2) Below is the error I recieved from the useradmin app when I did the
 same -

 127.0.0.1.2012-07-24.11-17-36.3a723b6d-872c-49e2-878d-65fab3349ca5
 type 'exceptions.TypeError' define_tables() got an unexpected keyword
 argument 'signature'
 What am I doing wrong ?

 Thanks,
 Murtaza


 On Tuesday, July 24, 2012 9:27:49 AM UTC+5:30, Massimo Di Pierro wrote:

 This looks great. Are you proposing it as a replacement for the current
 welcome? pros? cons?

 On Monday, 23 July 2012 19:02:47 UTC-5, Martin.Mulone wrote:

 I want to share this two applications*

 Bootstrap welcome application*

 I made my own welcome scatfold app, using twitter bootstrap template. My
 version is more like from the example template.
 Download: 
 https://bitbucket.org/**mulonemartin/bootstrap/**overviewhttps://bitbucket.org/mulonemartin/bootstrap/overviewalso
  you can test
 here http://testbootstrap.tecnodoc.com.ar/.

 *User Panel Admin*

 An application to administer the auth_user table. You can add, remove,
 activate users/ add groups, also add users to groups and so on.
 https://bitbucket.org/**mulonemartin/usersadminhttps://bitbucket.org/mulonemartin/usersadmin



  --





-- 





[web2py] Nightly Build (for testers) for windows

2012-06-22 Thread Javier Pepe
Hello

I'm trying to use de lastest binary version and get the follow error:

Traceback (most recent call last):
   File web2pypy, line 16, in module
zipimport.ZipImportError: can't find module 'gluon'

I need use this version to use scheduler.

Thanks

-- 





Re: [web2py] Re: Nightly Build (for testers) for windows

2012-06-22 Thread Javier Pepe
Thanks

I expect the final version


On Fri, Jun 22, 2012 at 3:20 PM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 There are some known issue with the windows nightly build because we are
 moving from python 2.5 to 2.7. He hope to resolve them soon.


 On Friday, 22 June 2012 11:53:42 UTC-5, Javier wrote:

 Hello

 I'm trying to use de lastest binary version and get the follow error:

 Traceback (most recent call last):
File web2pypy, line 16, in module
 zipimport.ZipImportError: can't find module 'gluon'

 I need use this version to use scheduler.

 Thanks


  --


-- 





Re: [web2py] web2py interactive console

2012-06-06 Thread Javier Pepe
Hello

You need add the -M option to load models.



On Wed, Jun 6, 2012 at 6:25 AM, Hassan Alnatour
halna...@gardeniatelco.comwrote:

 Dear ALL ,

 i am trying  to use web2py from the terminal now i open the terminal and
 did this :

 $ cd web2py
 $ python web2py.py -S welcome


 here web2py will start the interactive console :

  db =  DAL('sqlite://storage.sqlite')
  db.tables
 []



 i didnt find my tables , why ??  i want to do this becouse i want to
 export a csv file for my auth_user







Re: [web2py] Re: Add conditional sub-menu

2012-04-12 Thread Javier Pepe
I was working on a set menu from the database. It's simple and it can be
useful.
The model is simple, and has a condition to evaluate options when
generating the menu items.
The evaluation was done using the function 'eval'.
Attach model.
To manage SQLFORM.grid use or what you like

db.define_table('menu',
Field('posicion',type='integer'),
Field('titulo',type='string'),
Field('controlador',type='string'),
Field('funcion',type='string'),
Field('padre'),
Field('condicion'),
   )
db.menu.padre.requires = IS_IN_DB(db, db.menu.id,'%(titulo)s')
db.menu.padre.represent = lambda id,row: db.menu(id).titulo
db.menu.condicion.default = 'True'

response.title = settings.title
response.subtitle = settings.subtitle
response.meta.author = '%(author)s %(author_email)s' % settings
response.meta.keywords = settings.keywords
response.meta.description = settings.description
response.menu = [ ]


def add_item(nivel):
item = []
for itemmenu in db((db.menu.padre == nivel)  (db.menu.id 
1)).select(orderby=db.menu.posicion):
if eval(itemmenu.condicion):

item.append([itemmenu.titulo,None,URL(itemmenu.controlador,itemmenu.funcion),add_item(
itemmenu.id) ])
return item

if auth.is_logged_in():
response.menu = add_item(1)


On Thu, Apr 12, 2012 at 1:00 AM, Cliff cjk...@gmail.com wrote:

 I have something like this working:

 sub_menu = []
 if (auth.user_id != None) and ((auth.has_membership(role = 'admin'))):
 sub_menu = [('Admin',  False,  URL('admin')), ]
 response.menu = [('Home', False, URL('home','default','index'), []),
 (SPAN('Price List',_style='color:yellow'), True,
 URL('pricelist','default','index'),
 [('Guideline',  False,  URL('pricelist','default','guideline')),
  ('Multiplier Tables',  False,
  URL('pricelist','default','multitable')),
  ('Cut Charge Tables',  False,  URL('pricelist','default','cuttable')),
  (sub_menu),
 ])]

 On Wednesday, April 11, 2012 12:24:29 PM UTC-4, Omi Chiba wrote:

 The following menu works. It's add Admin menu next to Price List if
 the user has role admin. Now, I want to add the Admin menu as sub-menu
 of Price List where it's right after the Cut Charge Tables. How can I
 do this ?

 response.menu = [('Home', False, URL('home','default','index'), []),
 (SPAN('Price List',_style='color:yellow'), True,
 URL('pricelist','default','**index'),
 [('Guideline',  False,  URL('pricelist','default','**guideline')),
  ('Multiplier Tables',  False,  URL('pricelist','default','**
 multitable')),
  ('Cut Charge Tables',  False,  URL('pricelist','default','**
 cuttable')),
 ])]

 if (auth.user_id != None) and ((auth.has_membership(role = 'admin'))):
 response.menu += [('Admin',  False,  URL('admin')), ]




Re: [web2py] Re: SQLForm.grid : is it possible to delete multiple rows at once ?

2012-03-23 Thread Javier Pepe
sabsto

You can use selectable, for example:

selectable = lambda ids: delete(ids)
form=SQLFORM.grid(query,selectable=selectable)

def delete(ids):
to_delete=db(db.tabla.id.belongs(ids))
to_delete.delete()




On Fri, Mar 23, 2012 at 9:46 PM, Derek sp1d...@gmail.com wrote:

 Or you could avoid javascript, store the IDs of the deleted items in the
 session and do your own calls to the DAL to delete items.


 On Friday, March 23, 2012 7:33:42 AM UTC-7, Anthony wrote:

 Is it possible to select and delete multiple rows with one button click
 using SQLFORM.grid ?  (instead of clicking delete on each row)
 I tried the selectable property but this doesn't help to delete.
 I searched the archive of this group / mailing-list without success


 Not out of the box. I suppose you could add a column (via the links
 argument) with delete checkboxes, and then add a delete checked button
 to the page with a Javascript event handler that identifies the checked
 records, submits a request to the server, and then possibly reloads the
 whole page or just the grid via Ajax.

 Anthony




Re: [web2py] Select Where first letter is A

2012-02-09 Thread Javier Pepe
From manual:

http://web2py.com/books/default/chapter/29/6#like,-startswith,-contains,-upper,-lower

db.mytable.myfield.startswith('value')


On Thu, Feb 9, 2012 at 11:06 AM, Web2Py Freak halna...@gardeniatelco.comwrote:

 Dear All ,

 How Can i select everything in the table the starts with A

 Best Regards,
 Hassan Alnatour



Re: [web2py] SQLFORM.grid collection of posts

2011-10-31 Thread Javier Pepe
Nick

I'm use the attribute _class to make a button

 A('Detalle',_class='button',_href='index/detalle/%s' % row.id)

This class render a button, same a the buttons on grid.



On Fri, Oct 28, 2011 at 11:08 PM, Nik Go nikolai...@gmail.com wrote:

 It mentions: If you use jqueryui then the links are rendered as buttons.
 

 am still trying to find an answer about how to use icons for your custom
 buttons.

 On Friday, October 28, 2011, Cliff wrote:

 I'll try to keep an eye on it.

 On Oct 27, 1:47 pm, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:
  Thanks this is useful! Mind that the API may still fluctuate a bit.
 
  On Oct 26, 4:38 pm, Cliff cjk...@gmail.com wrote:
 
 
 
 
 
 
 
   You can find a digest of posts about SQLFORM.grid here:
 
  https://docs.google.com/document/d/1p-OXDn75Nt2qmXQ0lvjqr4tYIf2PTIQx6.
 ..
 
   I know it is not complete, but it may help you get started.
 
   Also there is some good information in the source file: gluon/
   sqlhtml,  Just looking at the signature of the grid function is very
   instructive.
 
   If you find something I've missed, just let me know.
 
   Cliff Kachinske




Re: [web2py] Re: Overriding Grid/Smartgrid's 'Edit/Delete/View'

2011-10-06 Thread Javier Pepe
Hello

Along with the question of Johann, you can add new buttons to the grid
/ SmartGrid, because the links are render as links, and not as
buttons.

Thanks

On Thu, Oct 6, 2011 at 9:36 AM, apple simo...@gmail.com wrote:
 You can add your own buttons using:

 links = [lambda row: A('Edit',_href=URL(controller,edit,
 args=[update, tablename, a.id]))

 and set editable, deletable, details  to False.


 On Oct 6, 12:48 pm, Johann Spies johann.sp...@gmail.com wrote:
 How do I override the views/controllers  triggered by the buttons  mentioned
 in the subject line when using SQLFORM.grid/smartgrid?

 Regards
 Johann

 --
  May grace and peace be yours in abundance through the full knowledge of God
 and of Jesus our Lord!  His divine power has given us everything we need for
 life and godliness through the full knowledge of the one who called us by
 his own glory and excellence.
                                                     2 Pet. 1:2b,3a