[web2py] Re: SQLFORM.grid links not working

2016-05-09 Thread Simon Carr
Thanks Anthony,

I actually got it working using request.args(len(request.args)-1)

Your solution is far more elegant. I have not used python for a few years 
and I forgot about slicing.

Thanks
Simon

On Monday, 9 May 2016 16:37:10 UTC+1, Anthony wrote:
>
> See my response here: 
> https://groups.google.com/d/msg/web2py/covZOWYOQ1M/NyZkDW5IBAAJ
>
> You need something like SQLFORM.grid(..., args=request.args[:1]).
>
> Anthony
>
> On Sunday, May 8, 2016 at 4:17:57 PM UTC-4, Simon Carr wrote:
>>
>> I think I now know why it's not working, but I don't know how to fix it. 
>> I think the issue is that I am filtering my supplier_contacts by getting 
>> the supplier_id from request.args(0) however, the links on the SQLFORM.grid 
>> look like this
>>
>> http://127.0.0.1:8000/srm/supplier/view/view/supplier_contacts/1
>>
>> As you can see the supplier_id is not collected by request.args(0).
>>
>> Is it possible for SQLFORM.grid to use url vars i.e.  
>>
>> http://
>> 127.0.0.1:8000/srm/supplier/view/view/supplier_contacts?supplier_id=1
>>
>>
>>
>> On Sunday, 8 May 2016 19:45:22 UTC+1, Simon Carr wrote:
>>>
>>> I have an SQLFORM.grid in a view to display a list of supplier contacts
>>>
>>> When I click "Add Record", I get the error below.
>>>
>>> Traceback
>>>
>>> 1.
>>> 2.
>>> 3.
>>> 4.
>>> 5.
>>> 6.
>>>
>>> Traceback (most recent call last):
>>>   File "E:\web2py\gluon\restricted.py", line 227, in restricted
>>> exec ccode in environment
>>>   File "E:\web2py\applications\srm\views\supplier/view.html", line 75, in 
>>> 
>>> AttributeError: 'NoneType' object has no attribute 'company_name'
>>>
>>>
>>>
>>> I don't understand why  'company_name' is causing an error because it is 
>>> not a field in my supplier_contacts table, it is in my supplier table.
>>>
>>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: SQLFORM.grid links not working

2016-05-09 Thread Anthony
See my response here: 
https://groups.google.com/d/msg/web2py/covZOWYOQ1M/NyZkDW5IBAAJ

You need something like SQLFORM.grid(..., args=request.args[:1]).

Anthony

On Sunday, May 8, 2016 at 4:17:57 PM UTC-4, Simon Carr wrote:
>
> I think I now know why it's not working, but I don't know how to fix it. I 
> think the issue is that I am filtering my supplier_contacts by getting the 
> supplier_id from request.args(0) however, the links on the SQLFORM.grid 
> look like this
>
> http://127.0.0.1:8000/srm/supplier/view/view/supplier_contacts/1
>
> As you can see the supplier_id is not collected by request.args(0).
>
> Is it possible for SQLFORM.grid to use url vars i.e.  
>
> http://
> 127.0.0.1:8000/srm/supplier/view/view/supplier_contacts?supplier_id=1
>
>
>
> On Sunday, 8 May 2016 19:45:22 UTC+1, Simon Carr wrote:
>>
>> I have an SQLFORM.grid in a view to display a list of supplier contacts
>>
>> When I click "Add Record", I get the error below.
>>
>> Traceback
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>>
>> Traceback (most recent call last):
>>   File "E:\web2py\gluon\restricted.py", line 227, in restricted
>> exec ccode in environment
>>   File "E:\web2py\applications\srm\views\supplier/view.html", line 75, in 
>> 
>> AttributeError: 'NoneType' object has no attribute 'company_name'
>>
>>
>>
>> I don't understand why  'company_name' is causing an error because it is 
>> not a field in my supplier_contacts table, it is in my supplier table.
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: SQLFORM.grid links not working

2016-05-08 Thread Simon Carr
I think I now know why it's not working, but I don't know how to fix it. I 
think the issue is that I am filtering my supplier_contacts by getting the 
supplier_id from request.args(0) however, the links on the SQLFORM.grid 
look like this

http://127.0.0.1:8000/srm/supplier/view/view/supplier_contacts/1

As you can see the supplier_id is not collected by request.args(0).

Is it possible for SQLFORM.grid to use url vars i.e.  

http://127.0.0.1:8000/srm/supplier/view/view/supplier_contacts?supplier_id=1



On Sunday, 8 May 2016 19:45:22 UTC+1, Simon Carr wrote:
>
> I have an SQLFORM.grid in a view to display a list of supplier contacts
>
> When I click "Add Record", I get the error below.
>
> Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
>
> Traceback (most recent call last):
>   File "E:\web2py\gluon\restricted.py", line 227, in restricted
> exec ccode in environment
>   File "E:\web2py\applications\srm\views\supplier/view.html", line 75, in 
> 
> AttributeError: 'NoneType' object has no attribute 'company_name'
>
>
>
> I don't understand why  'company_name' is causing an error because it is 
> not a field in my supplier_contacts table, it is in my supplier table.
>
>
>

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