title: Django DRF+ EmberJS2.6 related model data
body: <p>I have django app that handle restAPIs with following JSON response, also i have ember app with <a href="https://github.com/dustinfarris/ember-django-adapter" rel="nofollow">django-ember-adapter</a>. The problem is i can not get related items in the sub route(<code>http://localhost:8000/api/projects/4/tasks</code>) of API. I can get projects by <code>http://localhost:8000/api/projects/4</code>. Am i have to include task in project's django model in API?, I have tried using <code>links</code> in serializer but seems it's not working. </p>
  
  <p>How do i get <strong>project's tasks</strong> successfully? </p>
  
  <p>json response on <code>http://localhost:8000/api/projects/4</code> i can get this by <code>this.store.findRecord('project', params.project_id)</code>: </p>
  
  <pre><code>{
      "id": 4,
      "title": "test1 project",
      "description": "some project",
      "owner": "test1"
  }
  </code></pre>
  
  <p>json response on <code>http://localhost:8000/api/projects/4/tasks</code>:</p>
  
  <pre><code>{
      "count": 2,
      "next": null,
      "previous": null,
      "results": [
          {
              "id": 5,
              "title": "4th",
              "description": "4tg description"
          },
          {
              "id": 6,
              "title": "",
              "description": ""
          }
      ]
  }
  </code></pre>
  
  <p>django models:</p>
  
  <pre><code>class Project(models.Model):
      """Canara project """
      title = models.CharField(max_length=50, blank=True, default='')
      created = models.DateTimeField(auto_now_add=True)
      description = models.CharField(max_length=255, blank=True)
      active = models.BooleanField(default=True)
      owner = models.ForeignKey(User, related_name='projects', null=True)
  
      def __unicode__(self):
          return self.title
  
  
  class Task(models.Model):
      title = models.CharField(max_length=55, blank=True)
      description = models.CharField(max_length=255, blank=True)
      created = models.DateTimeField(auto_now_add=True)
      due_date = models.DateField(blank=True, null=True)
      assign = models.ForeignKey(User, null=True)
      project = models.ForeignKey(Project, null=True)
  </code></pre>
  
  <p>serializer:</p>
  
  <pre><code>class ProjectViewSet(ModelViewSet):
      """
      API endpoint for project
      """
      authentication_classes = [TokenAuthentication, SessionAuthentication]
      permission_classes = (IsAuthenticated, IsOwner)
      serializer_class = ProjectSerializer
  
      def get_queryset(self):
          """
          Get user's project
          """
          return Project.objects.filter(members__member=self.request.user)
  
      def perform_create(self, serializer):
          """
          Set user as an owner when create project
          """
          serializer.save(owner=self.request.user)
  
  class TaskViewSet(ModelViewSet):
      """
      API for task
      """
      authentication_classes = [TokenAuthentication, SessionAuthentication]
      permission_classes = [IsAuthenticated,]
      serializer_class = TaskSerializer
      queryset = Task.objects.all()
  </code></pre>
  
  <hr>
  
  <p>ember app's project model</p>
  
  <pre><code>export default Model.extend({
    title: attr(),
    description: attr(),
  });
  </code></pre>
  
  <p>ember app's task model</p>
  
  <pre><code>export default Model.extend({
    title: attr(),
    description: attr(),
    due_date: attr('date'),
    assign: belongsTo('user'),
    project: belongsTo('project')
  });
  </code></pre>
  
  <p><strong>Update</strong>
  I have tried embedded record mixin but no luck</p>
  
  <p>in the serializer:</p>
  
  <pre><code>class ProjectSerializer(serializers.ModelSerializer):
      owner = serializers.ReadOnlyField(source='owner.username')
  
      class Meta:
          model = Project
          fields = ('id', 'title', 'description', 'owner', 'tasks')
  
      def create(self, validated_data):
          """
          Create project using given validated data
          """
          return Project.objects.create(**validated_data)
  
      def update(self, instance, validated_data):
          """
          Update project title description
          """
          instance.title = validated_data.get('title', instance.title)
          instance.description = validated_data.get(
                  'description', instance.description)
          instance.save()
  
  
  class TaskSerializer(serializers.ModelSerializer):
      project = serializers.PrimaryKeyRelatedField(queryset=Project.objects.all())
      class Meta:
          model = Task
          fields = ('id', 'title', 'description', 'due_date', 'assign', 'project')
  
      def create(self, validated_data):
          return Task.objects.create(**validated_data)
  
      def update(self, instance, validated_data):
          instance.title = validated_data.get('title', instance.title)
          instance.description = validated_data.get('description', instance.description)
          instance.due_date = validated_data.get('due_date', instance.due_date)
          instance.assign = validated_data.get('assign', instance.assign)
  </code></pre>
  
  <p>i've tried links in this way:</p>
  
  <pre><code>import DRFSerializer from './drf';
  
  export default DRFSerializer.extend({
    normalizeFindAllResponse(store, primaryModelClass, payload, id, requestType) {
      console.log(payload)
      payload.links: {
          tasks: tasks
        };
      });
  
      return this._super(...arguments);
    }
  });
  </code></pre>