Skip to content

Instantly share code, notes, and snippets.

@meehow
Created June 1, 2012 08:45
Show Gist options
  • Save meehow/2850421 to your computer and use it in GitHub Desktop.
Save meehow/2850421 to your computer and use it in GitHub Desktop.
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from profiles.models import UserProfile
class Command(BaseCommand):
def handle(self, *args, **options):
for user in User.objects.all():
try:
profile = user.get_profile()
except UserProfile.DoesNotExist:
print user
UserProfile.objects.create(user=user)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment