title: Django Attribute error on serializer when using intermediate model
body: <p>I've been trying to create a serializer for a Model in which one of the fields is a ManytoManyField through a Model that adds more fields. The problem is that the intermediate serializer is not recognizing that has added fields. Why could I be doing wrong?</p>
  <p>Here is my code:</p>
  <p>models.py:</p>
  <pre><code>class Product(models.Model):
      name = models.CharField(max_length=30, unique=True)
  
  class Movement(models.Model):
      date = models.DateTimeField(auto_now_add=True)
      products = models.ManyToManyField(Product, through='Movement_Product')
  
  class Movement_Product(models.Model):
      movement = models.ForeignKey(Movement)
      product = models.ForeignKey(Product)
      amount = models.IntegerField()
      price = models.DecimalField(max_digits=9, decimal_places=2)
  
  class Input(Movement):
      invoice_number = models.CharField(max_length=30, null=True)
  </code></pre>
  <p>serializers.py:</p>
  <pre><code>class ProductSerializer(serializers.ModelSerializer):
  
      class Meta:
          model = Product
  
  class MovementProductSerializer(serializers.ModelSerializer):
      product = ProductSerializer()
      price = serializers.DecimalField(max_digits=9, decimal_places=2)
      amount = serializers.IntegerField()
  
      class Meta:
          model = Movement_Product
  
  class InputSerializer(serializers.ModelSerializer):
      date = serializers.DateTimeField()
      products = MovementProductSerializer(many=True)
  
      class Meta:
          model = Input
  </code></pre>
  <p>views.py:</p>
  <pre><code>class InputViewSet(viewsets.ModelViewSet):
      queryset = Input.objects.order_by('-date')
      serializer_class = InputSerializer
  </code></pre>
  <p>urls.py:</p>
  <pre><code>router = routers.DefaultRouter()
  router.register(r'input', views.InputViewSet)
  
  urlpatterns = [
      url(r'^api/', include(router.urls)),
      url(r'^admin/', admin.site.urls),
  ]
  </code></pre>
  <p>The error I got when I try to render the InputSerializer on URL path in my browser <a href="http://127.0.0.1:8000/api/input/" rel="nofollow noreferrer">http://127.0.0.1:8000/api/input/</a>:</p>
  <blockquote>
  <p>Attribute Error at /api/input/</p>
  <p>Got AttributeError when attempting to get a value for field <code>product</code> on serializer <code>MovementProductSerializer</code>.</p>
  <p>The serializer field might be named incorrectly and not match any attribute or key on the <code>Product</code> instance.</p>
  <p>Original exception text was: 'Product' object has no attribute 'product'.</p>
  </blockquote>