rejected users do not occupy a username

admin-improvements
Nate Smith 2019-07-15 21:15:33 -05:00
parent e59bd893fd
commit 31adb3cc3a
1 changed files with 1 additions and 1 deletions

View File

@ -23,7 +23,7 @@ def validate_username(username):
raise ValidationError('Username too short.') raise ValidationError('Username too short.')
if not USERNAME_RE.match(username): if not USERNAME_RE.match(username):
raise ValidationError('Username must be all lowercase, start with a letter, and only use the _ special character') raise ValidationError('Username must be all lowercase, start with a letter, and only use the _ special character')
duplicate = Townie.objects.filter(username=username).count() duplicate = Townie.objects.filter(username=username).exclude(state=Townie.REJECTED).count()
if duplicate > 0: if duplicate > 0:
raise ValidationError('Username already in use :(') raise ValidationError('Username already in use :(')