title: Filtering a reverse relationship by user, and returning only one object in Django Rest Framework
body: <p>Given these models:</p>
  
  <pre><code>class Product(models.Model):
      name = CharField(max_length=255)
  
  class Order(models.Model):
      product = models.ForeignKey(Product)
      user = models.ForeignKey(User)
      quantity = models.PositiveIntegerField()
  </code></pre>
  
  <p>A user can only have a single Order object per product. I would like an API call to show a list of products, with the user's order where available. Is there a way to do that?</p>
  
  <p>The default serialisation lists ALL orders under <code>order_set</code>. I did get a bit ahead with this to filter by user:</p>
  
  <pre><code>class FilteredOrderSerializer(serialisers.ListSerializer):
      def to_representation(self, data):
          data = data.filter(user=self.context['request'].user)
          return super(FilteredOrderSerializer, self).to_representation(data)
  
  
  class OrderSerializer(serializers.ModelSerializer):
      class Meta:
          model = Order
          list_serializer_class = FilteredOrderSerializer
  
  
  class ProductSerializer(serializers.ModelSerializer):
      order_set = OrderSerializer(many=True, read_only=True)
  
      class Meta:
          model = Product
  </code></pre>
  
  <p>So now it only shows the authenticated user's order, but the resulting JSON looks something like</p>
  
  <pre><code>[
      {
          "name": "prod1",
          "order_set": [
              {
                  "quantity": 4
              }
          ],
      }
  ]
  </code></pre>
  
  <p>i.e. the field is still called <code>order_set</code> and it's a list, while I would like it to be called <code>order</code> and be either an object or null. So I'm not sure where this filtering should take place, nor how to define the field.</p>
  
  <p>Edit: I'm using a simple viewset</p>
  
  <pre><code>class ProductViewSet(view sets.ReadOnlyModelViewSet):
      queryset = Product.objects.all()
      serializer_class = ProductSerializer
  </code></pre>