Created
          May 11, 2017 20:26 
        
      - 
      
- 
        Save vladimirmyshkovski/096f240c3cdc8d2f0aa894a822c9d9b2 to your computer and use it in GitHub Desktop. 
    Generate fake users for Django
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | from myapp.models import User | |
| ...: | |
| ...: users = [] | |
| ...: | |
| ...: for i in range(1000): | |
| ...: user = User(first_name='User%dFirstName' % i, | |
| ...: last_name='User%dLastName' % i, | |
| ...: username='user%d' % i, | |
| ...: email='user%[email protected]' % i, | |
| ...: password='hashedPasswordStringPastedHereFromStep1!', | |
| ...: is_active=True, | |
| ...: ) | |
| ...: users.append(user) | |
| ...: | |
| ...: User.objects.bulk_create(users) | |
| ...: | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment