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}}
> <center style="background-color: #428bca; color:white; padding:30px">
> <h1>/{{=request.application}}
> </center>
> {{end}}
>
>
>
>
> {{if 'message' in globals():}}
> <h2>{{=message}}</h2>
> {{pass}}
> {{=flexlist}}
>
>
> default index
> {{extend 'layout.html'}}
> {{block header}}
> <center style="background-color: #428bca; color:white; padding:30px">
> <h1>/{{=request.application}}
> </center>
> {{end}}
> {{=A('View flexi list',_href=URL("default","show_flexlist",args=15))}}
>
>
> {{if 'message' in globals():}}
> <h2>{{=message}}</h2>
> {{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 [email protected].
For more options, visit https://groups.google.com/d/optout.