title: object has no attribute 'build_absolute_uri' - Django Rest Framework
body: <p>I am trying to view a url in my api (using Django Rest Framework), but I get the following error:</p>
  
  <pre><code>'Follow' object has no attribute 'build_absolute_uri'
  </code></pre>
  
  <p>I'm not sure what this means, so any help would be appreciated.</p>
  
  <p>Here's the traceback:</p>
  
  <pre><code>Traceback:
  File "/Users/jphalis/Desktop/oby/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
    132.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Users/jphalis/Desktop/oby/lib/python2.7/site-packages/django/views/decorators/csrf.py" in wrapped_view
    58.         return view_func(*args, **kwargs)
  File "/Users/jphalis/Desktop/oby/lib/python2.7/site-packages/django/views/generic/base.py" in view
    71.             return self.dispatch(request, *args, **kwargs)
  File "/Users/jphalis/Desktop/oby/lib/python2.7/site-packages/rest_framework/views.py" in dispatch
    451.             response = self.handle_exception(exc)
  File "/Users/jphalis/Desktop/oby/lib/python2.7/site-packages/rest_framework/views.py" in dispatch
    448.             response = handler(request, *args, **kwargs)
  File "/Users/jphalis/Desktop/oby/lib/python2.7/site-packages/rest_framework/generics.py" in get
    199.         return self.list(request, *args, **kwargs)
  File "/Users/jphalis/Desktop/oby/lib/python2.7/site-packages/rest_framework/mixins.py" in list
    44.             return self.get_paginated_response(serializer.data)
  File "/Users/jphalis/Desktop/oby/lib/python2.7/site-packages/rest_framework/serializers.py" in data
    618.         ret = super(ListSerializer, self).data
  File "/Users/jphalis/Desktop/oby/lib/python2.7/site-packages/rest_framework/serializers.py" in data
    213.                 self._data = self.to_representation(self.instance)
  File "/Users/jphalis/Desktop/oby/lib/python2.7/site-packages/rest_framework/serializers.py" in to_representation
    568.             self.child.to_representation(item) for item in iterable
  File "/Users/jphalis/Desktop/oby/lib/python2.7/site-packages/rest_framework/serializers.py" in to_representation
    435.                 ret[field.field_name] = field.to_representation(attribute)
  File "/Users/jphalis/Desktop/oby/lib/python2.7/site-packages/rest_framework/fields.py" in to_representation
    1330.         return method(value)
  File "/Users/jphalis/Desktop/oby/src/accounts/serializers.py" in get_supporting
    124.         return serializer.data
  File "/Users/jphalis/Desktop/oby/lib/python2.7/site-packages/rest_framework/serializers.py" in data
    618.         ret = super(ListSerializer, self).data
  File "/Users/jphalis/Desktop/oby/lib/python2.7/site-packages/rest_framework/serializers.py" in data
    213.                 self._data = self.to_representation(self.instance)
  File "/Users/jphalis/Desktop/oby/lib/python2.7/site-packages/rest_framework/serializers.py" in to_representation
    568.             self.child.to_representation(item) for item in iterable
  File "/Users/jphalis/Desktop/oby/lib/python2.7/site-packages/rest_framework/serializers.py" in to_representation
    435.                 ret[field.field_name] = field.to_representation(attribute)
  File "/Users/jphalis/Desktop/oby/lib/python2.7/site-packages/rest_framework/relations.py" in to_representation
    264.             return self.get_url(value, self.view_name, request, format)
  File "/Users/jphalis/Desktop/oby/src/accounts/serializers.py" in get_url
    34.                        request=request, format=format)
  File "/Users/jphalis/Desktop/oby/lib/python2.7/site-packages/rest_framework/reverse.py" in reverse
    26.     return _reverse(viewname, args, kwargs, request, format, **extra)
  File "/Users/jphalis/Desktop/oby/lib/python2.7/site-packages/rest_framework/reverse.py" in _reverse
    39.         return request.build_absolute_uri(url)
  
  Exception Type: AttributeError at /api2/follows/
  Exception Value: 'Follow' object has no attribute 'build_absolute_uri'
  </code></pre>
  
  <p>I'm assuming it's referring to my model, so here's that as well:</p>
  
  <pre><code>class Follow(models.Model):
      user = models.OneToOneField(MyUser)
      followers = models.ManyToManyField('self',
                                         related_name='following',
                                         symmetrical=False)
  
      class Meta:
          app_label = 'accounts'
  
      def __unicode__(self):
          return str(self.user.username)
  
  MyUser.profile = property(lambda u: Follow.objects.get_or_create(user=u)[0])
  </code></pre>
  
  <p>Thank you in advance for your help!</p>
  
  <p><strong>- - EDIT:</strong></p>
  
  <p><strong><em>serializers.py:</em></strong></p>
  
  <pre><code>class FollowSerializer(serializers.HyperlinkedModelSerializer):
      username = serializers.CharField(source='user.username', read_only=True)
      supporters = serializers.SerializerMethodField(read_only=True)
      supporting = serializers.SerializerMethodField(read_only=True)
  
      def get_supporters(self, instance):
          queryset = Follow.objects.filter(following__pk=instance.pk)
          serializer = UserProfileSerializer(queryset,
                                             context={"request": instance},
                                             many=True)
          return serializer.data
  
      def get_supporting(self, instance):
          queryset = Follow.objects.filter(followers__pk=instance.pk)
          serializer = UserProfileSerializer(queryset,
                                             context={"request": instance},
                                             many=True)
          return serializer.data
  
      class Meta:
          model = Follow
          fields = [
              'username',
              'supporters',
              'supporting',
          ]
  
  class UserProfileSerializer(serializers.HyperlinkedModelSerializer):
      account_url = UserProfileUrlField("user_profile_detail_api")
      username = serializers.CharField(source='user.username')
  
      class Meta:
          model = UserProfile
          fields = [
              'account_url',
              'username',
          ]
  </code></pre>
  
  <p><strong>ListAPIView:</strong></p>
  
  <pre><code>class FollowListAPIView(generics.ListAPIView):
      authentication_classes = [SessionAuthentication, BasicAuthentication, JSONWebTokenAuthentication]
      permission_classes = [permissions.IsAuthenticated]
      serializer_class = FollowSerializer
      queryset = Follow.objects.all()
  </code></pre>