Skip to content


Subversion checkout URL

You can clone with
Download ZIP


same name count in leads to issues in some cases #47

iiilx opened this Issue · 0 comments

2 participants


I was tracking down a bug for more than a few hours and it came down to this. Basically I had a registered username of ben86lee2 in my app, and when I tried to register another account where the screen_name was ben86lee, the following code said there was already 1 user whose username started with "ben86lee". So it then tried to register ben86lee as ben86lee2 because of the "+1" step in the code below. But there already is a ben86lee2, so it finally gave an integrity error. So basically maybe the code could be changed to not use __startswith and just do exact matches instead. Or any other solution that would avoid this issue. Basically this error would occur anytime a username of "abc2" is registered but "abc" is not. Of course switch out "abc" with any username and the same error would occur.

same_name_count = (User.objects
if name_count:
            username = '%s%d' % (nickname, name_count + 1)

suggesting something like:

same_name_count = (User.objects
 if name_count:
            username = '%s%d' % (nickname, name_count + 1)

Thanks for your time and effort on this great open source package.

@shabda shabda closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.