old_contents: import factory
  
  from django.contrib.auth import get_user_model
  
  
  class UserFactory(factory.DjangoModelFactory):
      FACTORY_FOR = get_user_model()
      email = factory.Sequence(lambda i: 'email{}@example.com'.format(i))
      name = factory.Sequence(lambda i: 'Test User {}'.format(i))
  
new_contents: import factory
  
  try:
      from django.contrib.auth import get_user_model
      User = get_user_model()
  except ImportError:  # Django 1.4
      from django.contrib.auth.models import User
  
  
  class UserFactory(factory.DjangoModelFactory):
      FACTORY_FOR = User
      email = factory.Sequence(lambda i: 'email{}@example.com'.format(i))
      name = factory.Sequence(lambda i: 'Test User {}'.format(i))
  
subject: Fix UserFactory for django 1.4