from django.contrib.auth.models import User
password = User.objects.make_random_password()
user.set_password(password)
user.save()
BaseUserManager().make_random_password() # by deafult its generate 10 charactor password
'aYMX5Wk7Cu'
# Source
https://stackoverflow.com/questions/9480641/django-password-generator