Mercurial > public > sg101
comparison gpp/bio/forms.py @ 463:452835f4429f
Fixing #225; for some reason MySQL finds the user 'John' when searching for 'John ' (note trailing space). This doesn't happen on SQLite. This causes a NoReverseMatch when searching for 'John ' in the member search. The solution is to call strip() on the form field contents in the clean_username() method of the search form.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 09 Jul 2011 02:00:48 +0000 |
parents | e0523e17ea43 |
children | bbbc357ac5f3 |
comparison
equal
deleted
inserted
replaced
462:53fdaf0da539 | 463:452835f4429f |
---|---|
114 'all': settings.GPP_THIRD_PARTY_CSS['jquery-ui'] | 114 'all': settings.GPP_THIRD_PARTY_CSS['jquery-ui'] |
115 } | 115 } |
116 js = settings.GPP_THIRD_PARTY_JS['jquery-ui'] | 116 js = settings.GPP_THIRD_PARTY_JS['jquery-ui'] |
117 | 117 |
118 def clean_username(self): | 118 def clean_username(self): |
119 username = self.cleaned_data['username'] | 119 username = self.cleaned_data['username'].strip() |
120 try: | 120 try: |
121 User.objects.get(username=username, is_active=True) | 121 User.objects.get(username=username, is_active=True) |
122 except User.DoesNotExist: | 122 except User.DoesNotExist: |
123 raise forms.ValidationError("That username does not exist.") | 123 raise forms.ValidationError("That username does not exist.") |
124 return username | 124 return username |