I have a model I want to filter with a search term, which is usually a name. However in my database first_name
and last_name
are two separate fields.
e.g.
search_term = 'Will Sm'
db_persons
record: first_name = 'Will', last_name = 'Smith'
the search term would be able to retrieve this record.
How can I achieve that?
db_persons.objects.filter(__?__)
UPDATE:
Looking for a way to concatenate fields and querying the concatenated result without raw sql