title: Django REST Framework: SlugRelatedField for indirectly-related attribute?
body: <p>I have a Profile model that has a one-to-one relationship with Django's User model, and I have another model, called Permission (unrelated to Django's internal idea of permissions), that has a foreign key to Profile.  Like this: (I've removed most of the fields here, for simplicity)</p>
  
  <pre><code>from django.db import models
  from django.contrib.auth.models import User as DjangoUser
  
  class Account(models.Model):
      name = models.CharField(max_length=200, db_index=True)
  
  class Profile(models.Model):
      django_user = models.OneToOneField(DjangoUser)
      default_account = models.ForeignKey(Account)
  
  class Permission(models.Model):
      # Which user has the permission
      user = models.ForeignKey(Profile, db_index=True)
      # Which account they have the permission on
      account = models.ForeignKey(Account, db_index=True)
  </code></pre>
  
  <p>I want to make a serializer for Permission, that will create objects like this:</p>
  
  <pre><code>{
    "user": "me@example.com",
    "account": 123
  }
  </code></pre>
  
  <p>where the value of "account" is the account's primary key (so that's easy, I can use a PrimaryKeyRelatedField) and the value of "user" is the user's email address (this is the part I haven't figured out yet, because the email address is not stored directly on the Profile object, it's on the associated DjangoUser object).  Note also that this is NOT read-only -  when creating a Permission it does need to be able to deserialize from an email address to a Profile object.</p>
  
  <p>Some things I have tried so far, for representing the user on the Permission serializer ...</p>
  
  <p>1.</p>
  
  <pre><code>user = serializers.RelatedField(read_only=False)
  </code></pre>
  
  <p>With this one, if I POST an email address (or primary key or anything else) as the "user", it returns a 400 error saying <code>{"user": "This field is required."}</code>, as if I didn't include the field at all.</p>
  
  <p>2.</p>
  
  <pre><code>user = serializers.SlugRelatedField(slug_field='django_user.email')
  </code></pre>
  
  <p>With this one, I get <code>AttributeError: 'Profile' object has no attribute 'django_user.email'</code>.  Same thing happens if I use <code>'django_user__email'</code>.</p>
  
  <p>Any ideas?</p>