Skip to content

Instantly share code, notes, and snippets.

@clintonb
Created May 13, 2016 13:22
Show Gist options
  • Save clintonb/89845ee8afa0cad2791f7b29926a44c9 to your computer and use it in GitHub Desktop.
Save clintonb/89845ee8afa0cad2791f7b29926a44c9 to your computer and use it in GitHub Desktop.
Create profiles for edx-platform service users
""" Create profiles for service users. """
from django.contrib.auth import get_user_model
from student.models import UserProfile
User = get_user_model()
usernames = ('affiliate_window', 'course_discovery_worker', 'programs_worker', 'sailthru',)
for username in usernames:
user = User.objects.get(username=username)
profile, created = UserProfile.objects.get_or_create(user=user)
if created:
print 'Created profile for {username}'.format(username=username)
else:
print 'Profile already exists for {username}'.format(username=username)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment