KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
How can I query on the full name in Django? To clarify, I essentially want to do create a temporary column, combining first_name and last_name to give a fullname, then do a LIKE on that, like so: select [fields] from Users where CONCAT(first_name, ' ', last_name) LIKE '%John Smith%"; The above query would return all users named John Smith. If possible I'd like to avoid using a raw SQL call. The model I'm talking about specifically is the stock django.contrib.auth.models User model. Making changes to the model directly isn't a problem. For example, if a user was to search for 'John Paul Smith', it should match users with a first name of 'John Paul' and last name 'Smith', as well as users with first name 'John' and last name 'Paul Smith'.
Tags (comma-separated)
Save Edits
Cancel