I asked this question before. Maybe due to the lack of the desired answers, again, I see this as an opportunity to explain my problem well in this space.
Please note: I am using a MySQL database
I have a model called City . It contains an identifier, a name .
id name
1 New York
2 New India
3 New USA
4 New UK
Now using the syntax below
Please note: As an example, I set a static value, namely New in the syntax below. In the end, it should be a dynamic value.
City.objects.filter (name__icontains = "New")
Obviously, I get New York, New India, New USA, New United Kingdom
.
. -. newyork () New York () NEWYORK () NEw yOrk () - , .
City.objects.filter(name__iregex= "newyork") ?
CURRENT OUTPUT is:
[]
DESIRED OUTPUT is:
New York