def make_random_password(self, length=10, allowed_chars='abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'): """ Generates a random password with the given length and given allowed_chars """ # Note that default value of allowed_chars does not have "I" or letters # that look like it -- just to avoid confusion. return get_random_string(length, allowed_chars)
def generate_code(sender, instance, raw, using, **kwargs): if instance.code: return # 10 tries for uniqueness for i in xrange(10): code = get_random_string(5) if Invite.objects.filter(code=code).count(): continue instance.code = code
def make_random_password( self, length=10, allowed_chars='abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789' ): """ Generates a random password with the given length and given allowed_chars """ # Note that default value of allowed_chars does not have "I" or letters # that look like it -- just to avoid confusion. return get_random_string(length, allowed_chars)