I was given a task to randomly generate usernames and passwords for 80 users in Django. Here is how I did it:
Thanks to this excellent StackOverflow post, generating random characters become very easy:
I want to use lowercase characters for usernames and digits only for passwords. Thus, the optional parameter numbers_only is used to specific which format I want.
Then, open up the Django shell:
and Enter the following to the interactive shell to generate a user:
I saved the generate() inside utils.py which is located inside a project named note. Modify
from note import utils to suit your needs.