[web2py] Re: Calling a SQLFORM.grid from SQLFORM.grid return to the index page can't figure why

2018-09-05 Thread Yann Dulondel
First thank Anthony for your answer.
I pass the value of the column ID as an argument and it's the good value.
I have changed the code above show_flexlist instead of 
@auth.requires_login(), I use @auth.requires_signature(hash_vars=False) and 
now my detail list is displayed.

Yann


Le mardi 21 août 2018 16:44:57 UTC+2, Anthony a écrit :
>
> Is this the *exact *code? I see args=[row.id], but the query involves a 
> join, so I would expect row.id to throw an exception, as it should be 
> row.type_article.id.
>
> Anthony
>
> On Tuesday, August 21, 2018 at 9:10:39 AM UTC-4, Yann Dulondel wrote:
>>
>> Hello, web2py world.
>> I'm new to web2py and web development.
>> The index page displays a list of equipment type and has a link to a list 
>> of equipment of this type.
>> The index works fine but using the link redirect to the index page.
>> There is no error message.
>> When I replace the index code by the show_flexlist code, the equipment 
>> list is displayed 
>> I use MSSQL server and use the profiler to see what is the SQL command 
>> pass to it, but there is none.
>> I'm log in when I make a test. 
>> I'm sure stupid but want to understand how to be cured.
>> Best regards
>> Yann
>>
>>
>> default control
>>
>>
>> @auth.requires_login()
>> def index():
>> db.type_article.articlename.writable=False
>> db.type_article.id_narval.writable=False
>> db.type_article.writable=False
>> response.flash = T("Bonjour ")+auth.user.username
>> myquery=(db.type_article.id==db.articles.condi_id)&(db.articles.
>> depot_id==auth.user.id_depot)
>> myfields={db.type_article.articlename,db.type_article.id}
>> myheaders={'type_article.articlename':T('Type article'),
>> 'Type_article':'ID'}
>> default_sort_order=[db.type_article.articlename]
>>
>>
>> type_articles=SQLFORM.grid(query=myquery
>>,orderby=default_sort_order
>>, deletable=False
>>,editable=False
>>,details=False
>>, maxtextlength=64
>>, paginate=25
>>,create=False
>>,fields=myfields
>>,headers=myheaders
>>,field_id=db.type_article.id
>>,groupby=db.type_article.articlename|db.
>> type_article.id
>>,links = [lambda row: A('View flexi list',
>> _href=URL("default","show_flexlist",args=[row.id]))])
>> #,fields=fields,headers=headers
>> return dict(message=T('Welcome to Web Braid stock!'),type_articles=
>> type_articles)
>> @auth.requires_login()
>> def show_flexlist():
>> response.flash = T("valeur ")+request.args[0]+' /' +str(auth.user.
>> id_depot)
>> myquery=((db.articles.condi_id==request.args(0, cast=int))&(db.
>> articles.depot_id==auth.user.id_depot))
>> myfields={db.articles.cod_ref,db.articles.conteneur,db.articles.
>> dossier,db.articles.id}
>> myheaders={'articles.cod_ref':T('Flexi Number'),'articles.conteneur':
>> T('Conteneur Number'),'articles.dossier':T('Braid reference'),'
>> articles.id':'ID'}
>> default_sort_order=[db.articles.cod_ref]
>>
>>
>> flexlist=SQLFORM.grid(query=myquery
>>,orderby=default_sort_order
>>, deletable=False
>>,editable=False
>>,details=False
>>, maxtextlength=64
>>, paginate=25
>>,create=False
>>,fields=myfields
>>,headers=myheaders)
>>
>>
>>
>>
>> #,fields=fields,headers=headers
>> return dict(message=('test'),flexlist=flexlist)
>>
>>
>> default/show_flexlist.html
>>
>>
>> {{extend 'layout.html'}}
>> {{block header}}
>> 
>>   /{{=request.application}}
>> 
>> {{end}}
>>
>>
>>
>>
>> {{if 'message' in globals():}}
>> {{=message}}
>> {{pass}}
>> {{=flexlist}}
>>
>>
>> default index
>> {{extend 'layout.html'}}
>> {{block header}}
>> 
>>   /{{=request.application}}
>> 
>> {{end}}
>> {{=A('View flexi list',_href=URL("default","show_flexlist",args=15))}}
>>
>>
>> {{if 'message' in globals():}}
>> {{=message}}
>> {{pass}}
>> {{=type_articles}}
>>
>>

-- 
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: Calling a SQLFORM.grid from SQLFORM.grid return to the index page can't figure why

2018-08-21 Thread Anthony
Is this the *exact *code? I see args=[row.id], but the query involves a 
join, so I would expect row.id to throw an exception, as it should be 
row.type_article.id.

Anthony

On Tuesday, August 21, 2018 at 9:10:39 AM UTC-4, Yann Dulondel wrote:
>
> Hello, web2py world.
> I'm new to web2py and web development.
> The index page displays a list of equipment type and has a link to a list 
> of equipment of this type.
> The index works fine but using the link redirect to the index page.
> There is no error message.
> When I replace the index code by the show_flexlist code, the equipment 
> list is displayed 
> I use MSSQL server and use the profiler to see what is the SQL command 
> pass to it, but there is none.
> I'm log in when I make a test. 
> I'm sure stupid but want to understand how to be cured.
> Best regards
> Yann
>
>
> default control
>
>
> @auth.requires_login()
> def index():
> db.type_article.articlename.writable=False
> db.type_article.id_narval.writable=False
> db.type_article.writable=False
> response.flash = T("Bonjour ")+auth.user.username
> myquery=(db.type_article.id==db.articles.condi_id)&(db.articles.
> depot_id==auth.user.id_depot)
> myfields={db.type_article.articlename,db.type_article.id}
> myheaders={'type_article.articlename':T('Type article'),'Type_article'
> :'ID'}
> default_sort_order=[db.type_article.articlename]
>
>
> type_articles=SQLFORM.grid(query=myquery
>,orderby=default_sort_order
>, deletable=False
>,editable=False
>,details=False
>, maxtextlength=64
>, paginate=25
>,create=False
>,fields=myfields
>,headers=myheaders
>,field_id=db.type_article.id
>,groupby=db.type_article.articlename|db.
> type_article.id
>,links = [lambda row: A('View flexi list',
> _href=URL("default","show_flexlist",args=[row.id]))])
> #,fields=fields,headers=headers
> return dict(message=T('Welcome to Web Braid stock!'),type_articles=
> type_articles)
> @auth.requires_login()
> def show_flexlist():
> response.flash = T("valeur ")+request.args[0]+' /' +str(auth.user.
> id_depot)
> myquery=((db.articles.condi_id==request.args(0, cast=int))&(db.
> articles.depot_id==auth.user.id_depot))
> myfields={db.articles.cod_ref,db.articles.conteneur,db.articles.
> dossier,db.articles.id}
> myheaders={'articles.cod_ref':T('Flexi Number'),'articles.conteneur':T
> ('Conteneur Number'),'articles.dossier':T('Braid reference'),'articles.id'
> :'ID'}
> default_sort_order=[db.articles.cod_ref]
>
>
> flexlist=SQLFORM.grid(query=myquery
>,orderby=default_sort_order
>, deletable=False
>,editable=False
>,details=False
>, maxtextlength=64
>, paginate=25
>,create=False
>,fields=myfields
>,headers=myheaders)
>
>
>
>
> #,fields=fields,headers=headers
> return dict(message=('test'),flexlist=flexlist)
>
>
> default/show_flexlist.html
>
>
> {{extend 'layout.html'}}
> {{block header}}
> 
>   /{{=request.application}}
> 
> {{end}}
>
>
>
>
> {{if 'message' in globals():}}
> {{=message}}
> {{pass}}
> {{=flexlist}}
>
>
> default index
> {{extend 'layout.html'}}
> {{block header}}
> 
>   /{{=request.application}}
> 
> {{end}}
> {{=A('View flexi list',_href=URL("default","show_flexlist",args=15))}}
>
>
> {{if 'message' in globals():}}
> {{=message}}
> {{pass}}
> {{=type_articles}}
>
>

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