title: Django serialize multiple objects in one call
body: <p>I was wondering how I can decrease the number of calls to my database when serializing:</p>
  
  <p>I have the following 2 models: </p>
  
  <pre><code> class House(models.Model):
       name = models.CharField(max_length = 100, null = True, blank = True)
       address = models.CharField(max_length = 500, null = True, blank = True)
  
   class Room(models.Model):
        house = models.ForeignKey(House)
        name  = models.CharField(max_length = 100)
  </code></pre>
  
  <p>There is 1 house, it can have multiple Room.</p>
  
  <p>I am using django-rest-framework and trying to serialize all 3 things together at the house level.</p>
  
  <pre><code> class HouseSerializer(serializers.ModelSerializer)
      rooms = serializers.SerializerMethodField('room_serializer')
  
      def room_serializer(self):
           rooms = Room.objects.filter(house_id = self.id) # we are in House serializer, so self is a house
           return RoomSerializer(rooms).data
  
      class Meta:
          model = House
          fields = ('id', 'name', 'address')
  </code></pre>
  
  <p>So now, for every house I want to serialize, I need to make a separate call for its Rooms.  It works, but that's an extra call.
  (imagine me trying to package a lot of stuff together!)</p>
  
  <p>Now, if I had 100 houses, to serialize everything, I would need to make 100 Database hits, O(n) time</p>
  
  <p>I know I can decrease this to 2 hits, if I can get all the information together. O(1) time</p>
  
  <pre><code>my_houses = Houses.objects.filter(name = "mine")
  my_rooms = Rooms.objects.filter(house_id__in = [house.id for house in my_houses])
  </code></pre>
  
  <p>My question is how can I do this? and get the serializers to be happy?  </p>
  
  <p>Can I somehow do a loop after doing my two calls, to "attach" a Room to a House, then serialize it?  (am I allowed to add an attribute like that?)  If I can, how do i get my serializer to read it?</p>
  
  <p>Please note that I do not need django-rest-serializer to allow me to change the attributes in the Rooms, this way.  This is for GET only.</p>