reporead: ignore nicknames in name matching code
This commit is contained in:
parent
ed49122429
commit
5e509529f0
@ -137,6 +137,10 @@ def user_name():
|
|||||||
# one of the two name fields.
|
# one of the two name fields.
|
||||||
name_q = Q()
|
name_q = Q()
|
||||||
for token in name.split():
|
for token in name.split():
|
||||||
|
# ignore quoted parts; e.g. nicknames in strings
|
||||||
|
if re.match(r'^[\'"].*[\'"]$', token):
|
||||||
|
print "token match:", token
|
||||||
|
continue
|
||||||
name_q &= (Q(first_name__icontains=token) |
|
name_q &= (Q(first_name__icontains=token) |
|
||||||
Q(last_name__icontains=token))
|
Q(last_name__icontains=token))
|
||||||
return User.objects.get(name_q)
|
return User.objects.get(name_q)
|
||||||
|
Loading…
Reference in New Issue
Block a user