title: Serialize related models and override the create method
body: <p>I am new to DRF and I want to do something similar to the formsets in django forms
  I have an <code>Invoice</code> And <code>Products</code> models related to each other throw a many to many <code>InvoiceDetail</code> model.. when I create an Invoice I choose some products and create a <code>InvoiceDetail</code> object for each .. I want to do this in DRF how can I serialize the Invoice model and it's create function then?
  or should i do it form the view? </p>
  
  <p>models.py:</p>
  
  <pre><code> class Invoices(models.Model):
       #some fields
       products = models.ManyToManyField('Products', through='InvoiceDetail')
  
  
  class Products(models.Model):
      #some fields
  
  
  class InvoiceDetail(models.Model):
      invoice = models.ForeignKey(Invoices, related_name='parent_invoice')
      product = models.ForeignKey(Products, related_name='parent_product')
      product_description = models.TextField()
      product_price = models.DecimalField(max_digits=9, decimal_places=2)
      quantity_sold = models.IntegerField()
  </code></pre>
  
  <p>serializers.py:</p>
  
  <pre><code>class ProductsSerializer(serializers.ModelSerializer):
      class Meta:
          model = Products
          fields = ('barcode', 'product_code', 'name', 'description', 'category',
                    'quantity_in_stock', 'quantity_on_hold', 'expire_date',
                    'vendor', 'manufacturer', 'discount')
  
  
  class InvoiceDetailsSerializer(serializers.ModelSerializer):
      class Meta:
          model = InvoiceDetail
          fields = '__all__'
  </code></pre>
  
  <p>view.py: </p>
  
  <pre><code>class ProductsView(viewsets.ReadOnlyModelViewSet):
      queryset = Products.objects
      serializer_class = ProductsSerializer
  
  
  class InvoicesView(viewsets.ModelViewSet):
      queryset = Invoices.objects
      serializer_class = InvoicesSerializer
  
  
  
  class InvoiceDetailView(viewsets.ModelViewSet):
      queryset = InvoiceDetail.objects
      serializer_class = InvoiceDetailsSerializer
  </code></pre>