Django Rest framework, how to include '__all__' fields and a related field in ModelSerializer ? : <p>I have two models, one with M2M relation and a related name. I want to include <strong>all</strong> fields in the serializer and the related field.</p>

<p>models.py:</p>

<pre><code>class Pizza(models.Model):
    name = models.CharField(max_length=50, unique=True)
    toppings = models.ManyToManyField(Topping, null=True, blank=True, related_name='pizzas')

class Topping(models.Model):
    name = models.CharField(max_length=50, unique=True)
    price = models.IntegerField(default=0)
</code></pre>

<p>serializer.py:</p>

<pre><code>class ToppingSerializer(serializers.ModelSerializer):
    class Meta:
        model = Topping
        fields = '__all__' 
</code></pre>

<p>This works but it doesn't include the related field.</p>

<pre><code> fields = ['name', 'price', 'pizzas'] 
</code></pre>

<p>This works exactly as I want, but what happens when Toppings model has a lot of fields. I want to do something like :</p>

<pre><code>fields = ['__all__', 'pizzas']
</code></pre>

<p>This syntax results in an error saying:</p>

<blockquote>
  <p>Field name <code>__all__</code> is not valid for model</p>
</blockquote>

<p>Is there a way to achieve the wanted behavior? Or the fields must be typed manually when using a related name ?</p>
