Hello everyone!
Currently I am working on Django.
I defined a 'Search' function in views.py:
def search(request):
q = request.GET.get("q")
if q:
ReactResul = Reactionsmeta.objects.filter(id__contains=q)
MetaResul = Metabolites.objects.filter(id__contains=q)
GeneRe
I believe you want to use icontains rather than contains. It’s case
insensitive.
I’m not sure without using regex it’s possible to return the results based on
any character in any order in the search string.
> On Apr 25, 2018, at 5:13 PM, shawn...@gmail.com wrote:
>
> Hello everyone!
>
> Cu
Thank you for your help! And yes, I think I should use regex. But could you
please show me how to use it in my example, since I am new to django..
在 2018年4月26日星期四 UTC+1上午2:14:10,James Farris写道:
>
> I believe you want to use icontains rather than contains. It’s case
> insensitive.
>
> I’m not su
Try using filter(id__regex=r'\w’)
I’m not sure if this will give you the exact results your looking for, but
worth a shot.
Sent from my mobile device
> On Apr 26, 2018, at 2:31 AM, shawn...@gmail.com wrote:
>
> Thank you for your help! And yes, I think I should use regex. But could you
> pl
But how about my query string? I am using 'q' as the search term
在 2018年4月26日星期四 UTC下午3:19:15,James Farris写道:
>
> Try using filter(id__regex=r'\w’)
>
> I’m not sure if this will give you the exact results your looking for, but
> worth a shot.
>
>
> Sent from my mobile device
>
> On Apr 26, 2018,
What are the rules - you say that a query string of '10FTK' should match
'10FTH86RSK', but also '10FTK', '10F6TK', '10FTK4'
I think the problem is that the rules aren't 100% clear.
* For '10FTK' to match '10FTH' you actually only care about the
first 4 characters ?
* For '10FTK' to mat
6 matches
Mail list logo