title: django restframework :getting NotImplementedError
body: <p>I m getting a NotimplementError. I m working on Django restframework authentications and permissions. I m able to input data through admin panel but when is comes to serializers I m getting this error.</p>
  
  <p>Below is the error report:</p>
  
  <pre><code>NotImplementedError at /api/tasks/
  
  Field.to_representation() must be implemented for field owner. If you do not need to support write operations you probably want to subclass `ReadOnlyField` instead.
  
  Request Method:     GET
  Request URL:    http://127.0.0.1:8000/api/tasks/
  Django Version:     1.9
  Exception Type:     NotImplementedError
  Exception Value:    
  
  Field.to_representation() must be implemented for field owner. If you do not need to support write operations you probably want to subclass `ReadOnlyField` instead.
  
  Exception Location:     /home/graymatter/test/bookenv/local/lib/python2.7/site-packages/rest_framework/fields.py in to_representation, line 529
  Python Executable:  /home/graymatter/test/bookenv/bin/python
  Python Version:     2.7.6
  Python Path:    
  
  ['/home/graymatter/test/todo',
   '/home/graymatter/test/bookenv/lib/python2.7',
   '/home/graymatter/test/bookenv/lib/python2.7/plat-x86_64-linux-gnu',
   '/home/graymatter/test/bookenv/lib/python2.7/lib-tk',
   '/home/graymatter/test/bookenv/lib/python2.7/lib-old',
   '/home/graymatter/test/bookenv/lib/python2.7/lib-dynload',
   '/usr/lib/python2.7',
   '/usr/lib/python2.7/plat-x86_64-linux-gnu',
   '/usr/lib/python2.7/lib-tk',
   '/home/graymatter/test/bookenv/local/lib/python2.7/site-packages']
  
  Server time:    Tue, 8 Mar 2016 09:03:24 +0000
  </code></pre>
  
  <p>here is my serializers.py</p>
  
  <pre><code>from rest_framework import serializers
  
  from .models import Task
  
  
  class TaskSerializers(serializers.ModelSerializer):
      owner = serializers.Field(source='owner.username')
  
      class Meta:
          model = Task
          fields = ('title', 'desc', 'completed', 'owner')
  </code></pre>
  
  <p>views.py:</p>
  
  <pre><code>from django.shortcuts import render
  from rest_framework import generics
  from rest_framework import mixins
  
  from .models import Task
  from .serializers import TaskSerializers
  from .permissions import IsOwnerOrReadOnly
  
  
  # Create your views here.
  class TaskMixin(object):
      queryset = Task.objects.all()
      serializer_class = TaskSerializers
      permission_classes = (IsOwnerOrReadOnly,)
  
      def pre_save(self, obj):
          obj.owner = self.request.user
  
  
  
  class TaskDetail(TaskMixin, generics.RetrieveUpdateAPIView):
      pass
  
  
  class TaskList(TaskMixin, generics.ListCreateAPIView):
      pass
  </code></pre>
  
  <p>below is models.py</p>
  
  <pre><code>from __future__ import unicode_literals
  
  from django.db import models
  
  
  # Create your models here.
  
  class Task(models.Model):
      owner = models.ForeignKey('auth.user', related_name='tasks')
      completed = models.BooleanField(default=False, verbose_name='Completed')
      title = models.CharField(max_length=200, verbose_name='Title')
      desc = models.TextField(verbose_name='Description')
  
      def __unicode__(self):
          return self.title
  </code></pre>
  
  <p>below is permissions.py</p>
  
  <pre><code>from rest_framework.permissions import BasePermission, SAFE_METHODS
  
  
  class IsOwnerOrReadOnly(BasePermission):
      def has_object_permission(self, request, view, obj):
          if request.method in SAFE_METHODS:
              return True
          return obj.owner == request.user
  </code></pre>
  
  <p>I m a beginner in Django and rest framework. I m following <a href="https://godjango.com/43-permissions-authentication-django-rest-framework-part-2/" rel="noreferrer">this</a> tutorial. Now I m stuck here. please help.</p>
  
  <p>Thanks!!!!</p>