title: In DRF(django-rest-framework), AttributeError 'str' object has no attribute '~~' How to solve it?
body: <p>I'm using DRF and be front of AttributeError 'str' object has no attribute '~~'.</p>
  
  <p><strong>my error page and code</strong></p>
  
  <pre><code>Environment:
  
  
  Request Method: GET
  Request URL: http://127.0.0.1:8000/blog/
  
  Django Version: 1.9.7
  Python Version: 3.5.2
  Installed Applications:
  ['django.contrib.admin',
   'django.contrib.auth',
   'django.contrib.contenttypes',
   'django.contrib.sessions',
   'django.contrib.messages',
   'django.contrib.staticfiles',
   'django.contrib.gis',
   'blog',
   'account',
   'taggit',
   'friendship',
   'rest_framework']
  Installed Middleware:
  ['django.middleware.security.SecurityMiddleware',
   'django.contrib.sessions.middleware.SessionMiddleware',
   'django.middleware.common.CommonMiddleware',
   'django.middleware.csrf.CsrfViewMiddleware',
   'django.contrib.auth.middleware.AuthenticationMiddleware',
   'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
   'django.contrib.messages.middleware.MessageMiddleware',
   'django.middleware.clickjacking.XFrameOptionsMiddleware']
  
  
  
  Traceback:
  
  File "/home/keepair/djangogirls/myvenv/lib/python3.5/site-packages/django/core/handlers/base.py" in get_response
    149.                     response = self.process_exception_by_middleware(e, request)
  
  File "/home/keepair/djangogirls/myvenv/lib/python3.5/site-packages/django/core/handlers/base.py" in get_response
    147.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
  
  File "/home/keepair/djangogirls/myvenv/lib/python3.5/site-packages/django/views/decorators/csrf.py" in wrapped_view
    58.         return view_func(*args, **kwargs)
  
  File "/home/keepair/djangogirls/myvenv/lib/python3.5/site-packages/django/views/generic/base.py" in view
    68.             return self.dispatch(request, *args, **kwargs)
  
  File "/home/keepair/djangogirls/myvenv/lib/python3.5/site-packages/rest_framework/views.py" in dispatch
    466.             response = self.handle_exception(exc)
  
  File "/home/keepair/djangogirls/myvenv/lib/python3.5/site-packages/rest_framework/views.py" in dispatch
    463.             response = handler(request, *args, **kwargs)
  
  File "/home/keepair/djangogirls/myvenv/lib/python3.5/site-packages/rest_framework/decorators.py" in handler
    52.             return func(*args, **kwargs)
  
  File "/home/keepair/djangogirls/blog/views.py" in post_list
    37.         return Response(serializer.data)
  
  File "/home/keepair/djangogirls/myvenv/lib/python3.5/site-packages/rest_framework/serializers.py" in data
    700.         ret = super(ListSerializer, self).data
  
  File "/home/keepair/djangogirls/myvenv/lib/python3.5/site-packages/rest_framework/serializers.py" in data
    239.                 self._data = self.to_representation(self.instance)
  
  File "/home/keepair/djangogirls/myvenv/lib/python3.5/site-packages/rest_framework/serializers.py" in to_representation
    618.             self.child.to_representation(item) for item in iterable
  
  File "/home/keepair/djangogirls/myvenv/lib/python3.5/site-packages/rest_framework/serializers.py" in &lt;listcomp&gt;
    618.             self.child.to_representation(item) for item in iterable
  
  File "/home/keepair/djangogirls/myvenv/lib/python3.5/site-packages/rest_framework/serializers.py" in to_representation
    463.                 attribute = field.get_attribute(instance)
  
  File "/home/keepair/djangogirls/myvenv/lib/python3.5/site-packages/rest_framework/relations.py" in get_attribute
    157.         return get_attribute(instance, self.source_attrs)
  
  File "/home/keepair/djangogirls/myvenv/lib/python3.5/site-packages/rest_framework/fields.py" in get_attribute
    83.                 instance = getattr(instance, attr)
  
  Exception Type: AttributeError at /blog/
  Exception Value: 'str' object has no attribute 'author'
  </code></pre>
  
  <p>I wonder how to make <code>serializers.py</code> codes.</p>
  
  <p>I already studied : <a href="http://www.django-rest-framework.org/api-guide/relations/" rel="nofollow">http://www.django-rest-framework.org/api-guide/relations/</a> </p>
  
  <p>But I don't understand what I should do. Where should I put <code>serializers.py</code>?
  And how to make my serializers code? Or maybe <code>models.ForienKey</code> is unavailable on using DRF?</p>
  
  <p><strong>blog/views.py</strong></p>
  
  <pre><code>@api_view(['GET'])
  def post_list(request, format=None):
      """
      List all snippets, or create a new snippet.
      """
      if request.method == 'GET':
          lat = request.POST.get('user_lat', '13')
          lon = request.POST.get('user_lon', '15')
          userpoint = GEOSGeometry('POINT(' + lat + ' ' + lon + ')', srid=4326)
          i=1
  
          while i:
              list_i = Post.objects.filter(point__distance_lte = (userpoint, D(km=i)))
              list_total = str(',' + ' list_i')
              post_list = list(chain(list_total))
              if len(post_list) &gt;= 0 :
                  break
  
          serializer = PostSerializer(post_list, many=True)
          return Response(serializer.data)
  </code></pre>