Objeto it's the table

almoxarifado_id it's a FK (reference field)


2014-06-09 14:48 GMT-03:00 LoveWeb2py <atayloru...@gmail.com>:

> No problem at all and I appreciate you trying to respond to English.
>
> Is Object your table name and Almoxarifado_id is your id field in Objeto?
>
> Objeto.almoxarifado_id
>
>
> On Monday, June 9, 2014 1:30:49 PM UTC-4, Fabiano Almeida wrote:
>
>> Hi,
>>
>> Sorry for my poor english, by lazy, sometimes I use google translate
>> (portuguese -> english), and don't check the translation.
>>
>> table1_inv_record = request.args(0)
>>
>> In this line you get de first args, but on click to edit record in grid,
>> the function it's called again and url change args, then first args in url
>> is 'edit', and this is literal, not numerical.
>>
>> row = db(db.table1.id==table1_inv_record).select()
>>
>> In edit mode (and changed url), get error because var table1_inv_record
>> is not numerical at this time. I think this is a line in your traceback
>> error.
>>
>> So I use try...except block to convert first arg in integer, if ok, use
>> session to store de right id sent in the original url.
>>
>>> alm = None # this is for prevent error case haven't args(0)
>>> if request.args: alm = request.args(0)
>>>   try:
>>>       if alm:
>>>           alm = int(alm)
>>>           *session.almoxarifado*=alm    # this line executes only if
>>> the previous line no error
>>>   except ValueError:
>>>       pass
>>> Objeto.almoxarifado_id.default = *session.almoxarifado*
>>
>>
>>
>>
>>
>>
>> 2014-06-09 13:47 GMT-03:00 LoveWeb2py <atayl...@gmail.com>:
>>
>> Hi Fabiano,
>>>
>>> Thank you for your reply. What do you mean by *"edit the registry of
>>> URL arguments are changed. "*
>>>
>>> Here is my code:
>>> def query_table2():
>>>    table2_records = []
>>>    table1_inv_record = request.args(0)
>>>    row = db(db.table1.id==table1_inv_record).select()
>>>    for line in row:
>>>       joined_records = line.inv_id
>>>    query=db.table1.id.belongs(joined_records)
>>>    grid=SQLFORM.grid(query, user_signature=False)
>>>    return dict(grid=grid)
>>>
>>> view for query_table2.html:
>>>    {{=grid}}
>>>
>>>
>>>
>>> On Friday, June 6, 2014 3:43:12 PM UTC-4, Fabiano Almeida wrote:
>>>
>>>> <type 'exceptions.ValueError'> invalid literal for int() with base 10:
>>>> 'edit'
>>>>
>>>> In some part of your code has converting string to numeric type.
>>>> Probably you should be picking up the URL argument and doing the
>>>> conversion, but when you edit the registry of URL arguments are changed.
>>>>
>>>> In my example, I use session and try...except to resolve this.
>>>>
>>>>
>>>>
>>>> 2014-06-06 15:29 GMT-03:00 Fabiano Almeida <fab...@techno7.com.br>:
>>>>
>>>>> Show your code
>>>>>
>>>>>
>>>>> 2014-06-06 15:18 GMT-03:00 LoveWeb2py <atayl...@gmail.com>:
>>>>>
>>>>> Now I get this error when I try to click edit on the query database:
>>>>>>
>>>>>> <type 'exceptions.ValueError'> invalid literal for int() with base
>>>>>> 10: 'edit'
>>>>>>
>>>>>> I've tried changing signature to false, but I don't think thats the
>>>>>> problem.
>>>>>>
>>>>>>
>>>>>> On Friday, June 6, 2014 1:17:39 PM UTC-4, LoveWeb2py wrote:
>>>>>>
>>>>>>> yes
>>>>>>>
>>>>>>>
>>>>>>> On Fri, Jun 6, 2014 at 1:09 PM, Fabiano Almeida <
>>>>>>> fab...@techno7.com.br> wrote:
>>>>>>>
>>>>>>>> Are you logged in your app?
>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Friday, June 6, 2014 1:03:35 PM UTC-4, Fabiano Almeida wrote:
>>>>>>>>>>
>>>>>>>>>> Try:
>>>>>>>>>>
>>>>>>>>>> grid = SQLFORM.grid(db.table,  user_signature=False)
>>>>>>>>>>
>>>>>>>>>> Em sexta-feira, 6 de junho de 2014 13h10min34s UTC-3, LoveWeb2py
>>>>>>>>>> escreveu:
>>>>>>>>>>>
>>>>>>>>>>> Hi Fabiano,
>>>>>>>>>>>
>>>>>>>>>>> I actually was already using grid= SQLFORM.grid(db.new_table).
>>>>>>>>>>> That is when I get the error.
>>>>>>>>>>>
>>>>>>>>>>> If I do grid='' to test it and just return the table without
>>>>>>>>>>> SQLFORM I can see it in the view, but when I apply SQLFORM I get 
>>>>>>>>>>> the error
>>>>>>>>>>> 'Rows' object has no attribute '_db'.
>>>>>>>>>>>
>>>>>>>>>>> I'm guessing this is because of the way SQLFORM handles the
>>>>>>>>>>> grid? Could there be something in  my model messing it up?
>>>>>>>>>>>
>>>>>>>>>>> On Friday, June 6, 2014 12:02:05 PM UTC-4, Fabiano Almeida wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>> You send var grid (see: return dict(grid=grid)). The first var
>>>>>>>>>>>> grid is a send var to your view, de second var grid is a local
>>>>>>>>>>>> var of your function.
>>>>>>>>>>>>
>>>>>>>>>>>> Then,
>>>>>>>>>>>> in controller use:
>>>>>>>>>>>> grid = SQLFORM.grid(db.new_table)
>>>>>>>>>>>> return dict(grid=grid)
>>>>>>>>>>>>
>>>>>>>>>>>> in the view use:
>>>>>>>>>>>> {{=grid}}
>>>>>>>>>>>>
>>>>>>>>>>>> Fabiano.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> 2014-06-06 12:45 GMT-03:00 LoveWeb2py <atayl...@gmail.com>:
>>>>>>>>>>>>
>>>>>>>>>>>>>  SQLFORM isn't working for me with
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> new_table = db(db.table1.id.belongs(record_ids)).select()
>>>>>>>>>>>>> if I do {{=new_table}} in my view I can see the records which
>>>>>>>>>>>>> belong to record_ids, but if I do:
>>>>>>>>>>>>>
>>>>>>>>>>>>> SQLFORM.grid(new_table)
>>>>>>>>>>>>> return dict(grid=grid)
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> I get an error 'Rows' object has no attribute '_db'
>>>>>>>>>>>>>
>>>>>>>>>>>>>  --
>>>>>>>>>>>>> Resources:
>>>>>>>>>>>>> - http://web2py.com
>>>>>>>>>>>>> - http://web2py.com/book (Documentation)
>>>>>>>>>>>>> - http://github.com/web2py/web2py (Source code)
>>>>>>>>>>>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>>>>>>>>>>>> ---
>>>>>>>>>>>>> You received this message because you are subscribed to the
>>>>>>>>>>>>> Google Groups "web2py-users" group.
>>>>>>>>>>>>> To unsubscribe from this group and stop receiving emails from
>>>>>>>>>>>>> it, send an email to web2py+un...@googlegroups.com.
>>>>>>>>>>>>> For more options, visit https://groups.google.com/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+un...@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 a topic in
>>>>>>>> the Google Groups "web2py-users" group.
>>>>>>>> To unsubscribe from this topic, visit https://groups.google.com/d/
>>>>>>>> topic/web2py/I8aGvbVcQxk/unsubscribe.
>>>>>>>>  To unsubscribe from this group and all its topics, send an email
>>>>>>>> to web2py+un...@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+un...@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+un...@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.

Reply via email to