From 5e509529f00bd50ddfc6638d92c601209664d5d8 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 4 Oct 2010 13:29:01 -0500 Subject: reporead: ignore nicknames in name matching code --- devel/management/commands/reporead.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/devel/management/commands/reporead.py b/devel/management/commands/reporead.py index 7c468001..544c4ecb 100644 --- a/devel/management/commands/reporead.py +++ b/devel/management/commands/reporead.py @@ -137,6 +137,10 @@ def user_name(): # one of the two name fields. name_q = Q() 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) | Q(last_name__icontains=token)) return User.objects.get(name_q) -- cgit v1.2.3-54-g00ecf