Yeah. This is commented in my PR description. However, I do believe this is
an appropriate behaviour as we can probably assume the user does not want
the numbers to begin with and can edit if necessary.

More magical suggestions will make things complicated and more error prone.

Shuhao
Sent from my phone.
On Sep 16, 2013 12:57 PM, "Mike Cooper" <notifications@github.com> wrote:

> In kitsune/users/helpers.py:
>
> > @@ -65,3 +66,27 @@ def private_message(user):
> >      msg = _('Private message')
> >      return Markup(u'<p class="pm"><a href="{url}">{msg}</a></p>'.format(
> >          url=url, msg=msg))
> > +
> > +
> > +def suggest_username(email):
> > +    username = email.split('@', 1)[0]
> > +
> > +    username_regex = r'^{0}[0-9]*$'.format(username)
> > +    users = User.objects.filter(username__regex=username_regex)
> > +
> > +    if users.count() > 0:
> > +        max_id = 0
> > +        for u in users:
> > +            # get the number at the end
> > +            i = u.username[len(username):]
>
> Will this work on something like "kittenlover19" ? the expected result
> would be "kittenlover20", but I think you will get "kittenlover110" with
> this algorithm.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/mozilla/kitsune/pull/1619/files#r6381963>
> .
>