title: Django REST: Cannot add (write) nested item
body: <p>I am attempting to POST a nested relationship with Django REST Framework (2.3.9), but I am getting this error:</p>
  
  <blockquote>
    <p>ValueError: Cannot add "": instance is on database "default", value is on database "None"</p>
  </blockquote>
  
  <p>It seems that Django (1.6) is not recognizing that my <code>HeartbeatSerializer</code> knows anything about <code>ItemSerializer</code></p>
  
  <pre class="lang-json prettyprint-override"><code>{
      "username":"testing",
      "heartbeat": {
          "items": [
              {
                  "item_date": "2013-11-24T05:08:12Z", 
                  "item_title": "disagreeing post", 
                  "item_type": "post", 
                  "item_karma": 25
              }
          ]
      }
  }
  </code></pre>
  
  <p>Here's the serializers.py:</p>
  
  <pre class="lang-python prettyprint-override"><code>class ItemSerializer(serializers.ModelSerializer):
      '''
          Item Serializer
  
          Items are User-generated Content which are captured 
          from various APIs made available from the Web or 
          Internet via REST consumed endpoints or Websites 
          which have been scraped.
      '''
  
      class Meta:
          model = Item
          # fields = ('id', 'item_title', 'item_karma',
          #           'item_type', 'item_date', )
  
  
  class DepthPatchSerializer(serializers.ModelSerializer):
      def __init__(self, model=None, **kwargs):
          if model is not None:
              self.Meta.model = model
          super(DepthPatchSerializer, self).__init__(**kwargs);
      def get_nested_field(self, model_field):
          return DepthPatchSerializer(model=model_field.rel.to)
  
  
  class HeartbeatSerializer(DepthPatchSerializer):
      '''
          Heartbeat Serializer
  
          Items are User-generated Content (USG) containers which are used
          to consolidate normalized User-generated Interactions (USI).
      '''
  
      # items_queryset = Item.objects.all()
      # items = ItemSerializer(items_queryset, many=True)
  
      class Meta:
          model = Heartbeat
          # fields = ('id', 'items', )
          depth = 1
  
  
  class HackerAddSerializer(serializers.ModelSerializer):
      '''
          User Serializer
  
          Each User is stored in the system itself for analysis and signaling.
  
          We store users such that subsets of user behavior through USG can be
          generated and analyzed.
      '''
  
      heartbeat = HeartbeatSerializer()
  
      def _save_heartbeat_data(self):
          heartbeat_data = self.init_data.get('heartbeat', None)
          if heartbeat_data:
              hs = HeartbeatSerializer(instance=self.object.heartbeat,
                                      data=heartbeat_data)
              import pdb; pdb.set_trace()  # XXX BREAKPOINT
              if hs.is_valid():
                  self.object.heartbeat = hs.object
                  hs.save()
              else:
                  raise Exception(hs.errors)
  
      def save(self):
          self._save_heartbeat_data()
  
          password = self.init_data.get('password', None)
          confirm = self.init_data.get('confirm', None)
          if password and password == confirm:
              self.object.set_password(password)
  
          super(HackerAddSerializer, self).save()
          return self.object
  
      class Meta:
          model = Hacker
          exclude = ['last_login', 'password',
                  'is_superuser', 'is_staff',
                  'is_active', 'user_permissions',
                  'groups', ]
  </code></pre>