old_contents: import logging
  
  from django.db import models
  from django.db.models.signals import post_save
  from django.db.utils import DatabaseError
  from django.dispatch import receiver
  from django.utils.translation import ugettext_lazy as _, ugettext
  
  STANDARD_EMAIL = "anonymous@readthedocs.org"
  
  log = logging.getLogger(__name__)
  
  class UserProfile (models.Model):
      """Additional information about a User.
      """
      user = models.ForeignKey('auth.User', verbose_name=_('User'), unique=True,
                               related_name='profile')
      whitelisted = models.BooleanField(_('Whitelisted'), default=False)
      homepage = models.CharField(_('Homepage'), max_length=100, blank=True)
      allow_email = models.BooleanField(_('Allow email'),
                                        help_text=_('Show your email on VCS '
                                                    'contributions.'),
                                        default=True)
  
      def __unicode__(self):
          return (ugettext("%(username)s's profile")
                  % {'username': self.user.username})
  
      def get_form(self):
          from .forms import UserProfileForm
          return UserProfileForm(instance=self)
  
      def get_absolute_url(self):
          return ('profiles_profile_detail', (),
                  {'username': self.user.username})
  
      get_absolute_url = models.permalink(get_absolute_url)
  
      def get_contribution_details(self):
          """
          Gets the line to put into commits to attribute the author.
  
          Returns a tuple (name, email)
          """
          if self.user.first_name and self.user.last_name:
              name = '%s %s' % (self.user.first_name, self.user.last_name)
          else:
              name = self.user.username
          if self.allow_email:
              email = self.user.email
          else:
              email = STANDARD_EMAIL
          return (name, email)
  
  
  @receiver(post_save, sender='auth.User')
  def create_profile(sender, **kwargs):
      if kwargs['created'] is True:
          try:
              UserProfile.objects.create(user_id=kwargs['instance'].id, whitelisted=False)
          except DatabaseError:
              log.error('Failed to create user profile', exc_info=True)
  
new_contents: import logging
  
  from django.db import models
  from django.db.models.signals import post_save
  from django.db.utils import DatabaseError
  from django.dispatch import receiver
  from django.utils.translation import ugettext_lazy as _, ugettext
  
  STANDARD_EMAIL = "anonymous@readthedocs.org"
  
  log = logging.getLogger(__name__)
  
  class UserProfile (models.Model):
      """Additional information about a User.
      """
      user = models.OneToOneField('auth.User', verbose_name=_('User'),
                                  related_name='profile')
      whitelisted = models.BooleanField(_('Whitelisted'), default=False)
      homepage = models.CharField(_('Homepage'), max_length=100, blank=True)
      allow_email = models.BooleanField(_('Allow email'),
                                        help_text=_('Show your email on VCS '
                                                    'contributions.'),
                                        default=True)
  
      def __unicode__(self):
          return (ugettext("%(username)s's profile")
                  % {'username': self.user.username})
  
      def get_form(self):
          from .forms import UserProfileForm
          return UserProfileForm(instance=self)
  
      def get_absolute_url(self):
          return ('profiles_profile_detail', (),
                  {'username': self.user.username})
  
      get_absolute_url = models.permalink(get_absolute_url)
  
      def get_contribution_details(self):
          """
          Gets the line to put into commits to attribute the author.
  
          Returns a tuple (name, email)
          """
          if self.user.first_name and self.user.last_name:
              name = '%s %s' % (self.user.first_name, self.user.last_name)
          else:
              name = self.user.username
          if self.allow_email:
              email = self.user.email
          else:
              email = STANDARD_EMAIL
          return (name, email)
  
  
  @receiver(post_save, sender='auth.User')
  def create_profile(sender, **kwargs):
      if kwargs['created'] is True:
          try:
              UserProfile.objects.create(user_id=kwargs['instance'].id, whitelisted=False)
          except DatabaseError:
              log.error('Failed to create user profile', exc_info=True)
  
subject: Switch UserProfile.user from ForeignKey(unique=True) to a OneToOneField as suggested by Django's fields.W342 check.