No, I was not recommending changing the field type to list:string -- that 
isn't the appropriate field type for your data. I was just mentioning that 
.contains only works on list fields, and in that case, it is looking for 
complete word matches within the list. The bottom line is that you cannot 
do this using the App Engine datastore -- that is one of its limitations. 
You could instead consider using the Search API 
<https://cloud.google.com/appengine/docs/python/search/>, but you'll need a 
way to get the data into the search indexes, and you won't be able to use 
the DAL for queries.

Note, if you want to simulate a .startswith query, I think you can do 
htmlDB.Articles.Author 
>= request.args(0).

Anthony

On Thursday, June 23, 2016 at 9:32:12 PM UTC-4, PRACHI VAKHARIA wrote:
>
>
>
> NEW MODIFIED CODE — STILL DOES NOT FUNCTION
>
> The following function does not work on GAE – the lines in Red.
>
> *MODEL*
>
> *htmlDB.define_table('Articles',*
> *    Field('Title'),*
> *    Field('HtmlBody', 'text', label="Enter Full Article"),*
> *    Field('Abstract', 'text', label="Enter Abstract"),*
> *    Field('Author', 'list:string'),*
> *    format='%(Title)s'*
> *    )*
>
> *CONTROLLER FUNCTION*
>
>
>
>
>
>
>
>
> *def HomeList():    if request.args(0):        AuthorQuery = 
> htmlDB.Articles.Author.contains(request.args(0))        List = 
> htmlDB(AuthorQuery).select(htmlDB.Articles.ALL, 
> orderby=~htmlDB.Articles.Dated)    else:        List = htmlDB().select( 
> htmlDB.Articles.ALL, orderby=~htmlDB.Articles.Dated, limitby=(0, 2) )    
> return dict(List=List)*
>
>
>
> For a URL like this
> *http://........../HomeList.html/AUTHOR NAME*
> The controller much check if the 'AUTHOR NAME' is in the 
>
> *htmlDB.Articles*
> *What should I do or change to make the above work? Can anyone post the 
> change in code or Field type required?*
>
> Thank you, again!
>
>
> — PRACHI — 
>
>
>
>
>

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