django rest framework nested fields with multiple models
<p>This is django and django rest framework. I have 2 models: User and phone. </p>

<blockquote>
  <p>The 1st problem:</p>
  
  <p>I want to be able to update user data(email) alongside phone
  data(phone numbers) in 1 single api update response. Phone number can
  be 0 or many. Well, like partial=True actually. If a user just want to
  update phone numbers, don't update email and vice versa.</p>
</blockquote>

<hr>

<p>Additional info: At the time of registering, phone is not included. Just basic user info (last name, first name, email, password). The phone can only get updated in the user profile form after registration is done. The user profile form is actually linking to multiple models, which is User and Phone</p>

<blockquote>
  <p>The 2nd problem: </p>
  
  <p>How to serialize multiple phone_numbers and save to db?</p>
</blockquote>

<pre><code>class User(AbstractBaseUser):
    email = models.EmailField(unique=True, default='')
    USERNAME_FIELD = 'email'


class Phone(models.Model):
    phone_number = models.CharField(max_length=10)
    owner = models.ForeignKey(User)

--------------------------------------
class UserSerializer(serializers.ModelSerializer):
    phone_number = PhoneSerializer(required=False, many=True)

    class Meta:
        model = User
        fields = ('email, 'phone_number')


class PhoneSerializer(serializers.ModelSerializer):

     class Meta:
          Model = Phone
          fields = ('phone_number')
</code></pre>

<p>The html form would have plus sign at the phone number field to indicate a new phone number can be added. example is <a href="http://formvalidation.io/examples/adding-dynamic-field/" rel="noreferrer">here</a></p>

<pre><code>email : admin@admin.com
phone number: 23423432423
(add more)
phone number: 3423423423
(add more)
...
</code></pre>

<p>The expected json</p>

<pre><code>{
'email': 'email@email.com',
'phone_number': '32432433223234'
}
</code></pre>

<p>or if many phone numbers are added</p>

<pre><code>{
'email': 'email@email.com',
'phone_number': '32432433223234',
'phone_number': '324342322342323'
}
</code></pre>

<p>or maybe </p>

<pre><code>{
'email': 'email@email.com',
'phone_number': ['32432433223234','324342322342323']
}
</code></pre>

<p>or maybe</p>

<pre><code>{
'email': 'email@email.com',
'Phone': [{'id': 1, 'phone_number': '32432433223234'}, {'id': 2, 'phone_number': '324342322342323'}]
}
</code></pre>

<p>is this json possible to do?
how can serializer and modelviewset do it?
sorry I'm totally new to drf</p>