How to generate one time password when creating user and send the same to users mail id in Django?
I would suggest different approach to this. 
When you create a user, set the active flag to false. so the account is not active and then cannot log in.
No need to generate a password, leave it blank.
Instead, create a url with special token and send the url. If the user goes to this url, it will present a form to set the password for this user.
This link is only one time use, and it can even expire after certain number of days.
You can look at PasswordResetTokenGenerator in django.contrib.auth.tokens to see how to generate such tokens and change it accordingly.
You will also need to craft the url to include somehow which user to use ( probably obscure it somehow as it is not apparent ).
I am trying to send a random one-time password to the user when I create a new user and make him change the password when the user login for the first time.