title: django rest framework serialize a dictionary without create a model
body: <p>My data is like this, I want to serialize them without creating model for them.</p>
  
  <pre><code>[
    {'form': 1, 'count': 1},
    {'form': 2, 'count': 3}
  ]
  </code></pre>
  
  <p>serilize to</p>
  
  <pre><code>[
    {'form': 'my form name 1', 'count': 1},
    {'form': 'my form name 2', 'count': 3}
  ]
  </code></pre>
  
  <p>I want to serialize it with serializer, get form name form model by pk.</p>
  
  <pre class="lang-py prettyprint-override"><code>class EavForm(models.Model):
      name = models.CharField(max_length=300)
      order = models.IntegerField(default=1)
  
  
  # serializer
  class CustomSerializer(serializers.Serializer):
      form = serializers.PrimaryKeyRelatedField(queryset=EavForm.objects.all())
      count = serializers.IntegerField()
  </code></pre>
  
  <p>Some error like <code>'int' object has no attribute 'pk'</code></p>
  
  <p>test in python control</p>
  
  <pre class="lang-py prettyprint-override"><code>d = [{'form': 1, 'count': 1}, {'form': 2, 'count': 1}]
  s = CustomSerializer(d, many=True)
  print(s.data)
  
  # error
  Traceback (most recent call last):
    File "backend/src/db_tools/del1.py", line 25, in &lt;module&gt;
      print(s.data)
    File "backend/lib/python3.7/site-packages/rest_framework/serializers.py", line 768, in data
      ret = super(ListSerializer, self).data
    File "backend/lib/python3.7/site-packages/rest_framework/serializers.py", line 262, in data
      self._data = self.to_representation(self.instance)
    File "backend/lib/python3.7/site-packages/rest_framework/serializers.py", line 686, in to_representation
      self.child.to_representation(item) for item in iterable
    File "backend/lib/python3.7/site-packages/rest_framework/serializers.py", line 686, in &lt;listcomp&gt;
      self.child.to_representation(item) for item in iterable
    File "backend/lib/python3.7/site-packages/rest_framework/serializers.py", line 530, in to_representation
      ret[field.field_name] = field.to_representation(attribute)
    File "backend/lib/python3.7/site-packages/rest_framework/relations.py", line 272, in to_representation
      return value.pk
  AttributeError: 'int' object has no attribute 'pk'
  
  </code></pre>