The ability to remove address and reduce min. search length to 1 (thanks keycloak!)

This commit is contained in:
dsc 2022-03-19 23:34:59 +02:00
parent 5fc91af0a4
commit 6d86bf77e7
3 changed files with 19 additions and 9 deletions

View file

@ -22,10 +22,10 @@ class User(pw.Model):
@staticmethod
async def search(needle) -> List['User']:
if not needle:
raise Exception("need search term")
needle = needle.replace("*", "")
needle = needle.lower()
if len(needle) <= 1:
raise Exception("need longer search term")
return User.select().where(
User.address.is_null(False),