Skip to content

Instantly share code, notes, and snippets.

Hien D. Nguyen hiendnguyen

Block or report user

Report or block hiendnguyen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jcinis / gist:2866253
Created Jun 4, 2012
Generate a random username for Django
View gist:2866253
from random import choice
from string import ascii_lowercase, digits
from django.contrib.auth.models import User
def generate_random_username(length=16, chars=ascii_lowercase+digits, split=4, delimiter='-'):
username = ''.join([choice(chars) for i in xrange(length)])
if split:
username = delimiter.join([username[start:start+split] for start in range(0, len(username), split)])
You can’t perform that action at this time.