title: Object of type is not JSON serializable
body: <p>Just started with Django Rest framework and following the great tutorial:
  <a href="https://sunscrapers.com/blog/ultimate-tutorial-django-rest-framework-part-1/" rel="nofollow noreferrer">https://sunscrapers.com/blog/ultimate-tutorial-django-rest-framework-part-1/</a></p>
  
  <p>I have created a test model:</p>
  
  <p><em>models.py</em></p>
  
  <pre><code>class Test(models.Model):
      name = models.CharField(max_length=100)
      age = models.IntegerField
  </code></pre>
  
  <p>And to make the object available through the API, I have implemented a serializer. This would serialize to XML, YAML or JSON, the latter is what I am interested in. Below is my serialization class.</p>
  
  <p><em>serializers.py</em></p>
  
  <pre><code>class TestSerializer(serializers.ModelSerializer):
      class Meta:
          model = models.Test
          fields = ('name', 'age')
  </code></pre>
  
  <p><em>app/views.py</em></p>
  
  <pre><code>class TestViewSet(viewsets.ModelViewSet):
      queryset = models.Test.objects.all()
      serializer_class = serializers.TestSerializer
  </code></pre>
  
  <p>However, it doesn't seem to serialize to JSON as expected as the error below shows:</p>
  
  <pre><code>File "C:\Program Files\Python38\lib\json\encoder.py", line 179, in default
      raise TypeError(f'Object of type {o.__class__.__name__} '
  TypeError: Object of type type is not JSON serializable
  </code></pre>
  
  <p>Worth adding, that it worked for like 2 hours then just went bad.</p>