4
To make a query to get the data accurately in Django, I use the filter
, thus:
usuarios = Usuarios.objects.filter(nome='Jonh')
This will generate an SQL similar to:
SELECT * FROM usuarios wHERE nome = 'Jonh'
As I’ve been using Django for a little while, I’d like to know in case how I would do to make a LIKE
.
The database I am using is Mysql.
I believe the two situations you indicated the
endswith
are having an error in the positioning of the%
. Since the%
indicates anything to that side, so in those parts, he should be on the left of the term sought, not on the right. If I’m wrong, disregard.– mutlei
copy paste, adjust, thank you.
– Homer Simpson