title: Django REST Framework nested serializer won't update
body: <p>As per the Django REST Framework version 3 <a href="http://www.django-rest-framework.org/api-guide/relations/#writable-nested-serializers" rel="nofollow">documentation</a>, in order to create a writable nested serializer, you need to write your own <code>create()</code> and <code>update()</code> methods. I've got reading and writing working, but update does not work.</p>
  
  <p>For example, if I send the following data into my serializer 3 times, I end up with 3 new Widgets created. I expected passing in a pre-existing <code>id</code> would trigger an update and call <code>update()</code>, but <code>create()</code> gets called instead. Seems like <code>id</code> is ignored which sorta makes sense since it's auto generated, so how do I achieve this?</p>
  
  <p>I have a feeling I'm missing something obvious, perhaps some extra handling in my view?</p>
  
  <p>views.py (really rough at the moment, please excuse)</p>
  
  <pre><code>from rest_framework.decorators import api_view
  from rest_framework.response import Response
  
  from widget.models import Widget
  from widget.serializers import WidgetSerializer
  
  @api_view()
  def create(request):
  
      data = {
          "id": 4,
          "widget_alpha": {
              "bits": [
                  {
                      "id": 3,
                      "name": "bit 1",
                      "widget": 4
                  }
              ],
              "bobs": [
                  {
                      "id": 3,
                      "name": "bob 1",
                      "widget": 4
                  }
              ],
              "name": "my wid",
              "widget": 4
          },
          "language": "en",
          "code": "123"
      }
  
      serializer = WidgetSerializer(data=data)
      if serializer.is_valid():
          serializer.save()
      else:
          print serializer.errors
  
      return Response({"message": "yay"})
  </code></pre>
  
  <p>Widget is a parent model, WidgetAlpha is a child and is comprised of several Bits and Bobs. Related <code>models.py</code> and <code>serializers.py</code> code below.</p>
  
  <p>models.py</p>
  
  <pre><code>from django.db import models
  
  class Widget(models.Model):
      LANGUAGE = (
          ('fr', 'French'),
          ('en', 'English'),
      )
  
      language = models.CharField(max_length=2, choices=LANGUAGE)
      code = models.CharField(max_length=6)
  
  class WidgetAlpha(models.Model):
      widget = models.OneToOneField(Widget, primary_key=True, related_name='widget_alpha')
      name = models.CharField(max_length=6)
  
  class Bit(models.Model):
  
      widget = models.ForeignKey(WidgetAlpha, related_name='bits')
      name = models.CharField(max_length=6)
  
  class Bob(models.Model):
  
      widget = models.ForeignKey(WidgetAlpha, related_name='bobs')
      name = models.CharField(max_length=6)
  </code></pre>
  
  <p>serializers.py</p>
  
  <pre><code>from rest_framework import serializers
  
  from widget.models import Widget, WidgetAlpha, Bit, Bob
  
  class BitsSerializer(serializers.ModelSerializer):
      class Meta:
          model = Bit
  
  class BobsSerializer(serializers.ModelSerializer):
      class Meta:
          model = Bob
  
  class WidgetAlphaSerializer(serializers.ModelSerializer):
  
      bits = BitsSerializer(many=True)
      bobs = BobsSerializer(many=True)
  
      class Meta:
          model = WidgetAlpha
  
  class WidgetSerializer(serializers.ModelSerializer):
      widget_alpha = WidgetAlphaSerializer()
  
      class Meta:
          model = Widget
  
      def create(self, validated_data):
          widget_alpha_data = validated_data.pop('widget_alpha')      
          bits_data = widget_alpha_data.pop('bits')
          bobs_data = widget_alpha_data.pop('bobs')
  
          widget = Widget.objects.create(**validated_data)
          alpha_widget = WidgetAlpha.objects.create(widget=widget, **widget_alpha_data)
  
          for bit_data in bits_data:
              Bit.objects.create(widget=alpha_widget, **bit_data)
  
          for bob_data in bobs_data:
              Bob.objects.create(widget=alpha_widget, **bob_data)
  
          return widget
  
      def update(self, instance, validated_data):
          # never get here :(
          return instance
  </code></pre>