'ListSerializer' object is not callable
<p>I am trying to implement Django-Rest framework for a voting application with content_type objects.  I tried using the <a href="https://github.com/Ian-Foote/rest-framework-generic-relations" rel="noreferrer">rest-framework-generic-relations</a> for serializers.py.  It seems to me that the error might be within serializer.py / views.py, but I am new to this framework and would appreciate your help!</p>

<p>views.py:</p>

<pre><code>class vote_detail(generics.RetrieveUpdateDestroyAPIView):
    queryset = VotedItem.objects.all()
    serializer_class = VoteSerializer(queryset, many=True)
</code></pre>

<p>serializers.py:</p>

<pre><code>from rest_framework import serializers
from .models import VotedItem
from posts.models import Post
from generic_relations.relations import GenericRelatedField

class PostSerializer(serializers.ModelSerializer):
    class Meta:
        model = Post
        fields = ('title',)

class VoteSerializer(serializers.ModelSerializer):
        """
        A `VotedItem` serializer with a `GenericRelatedField` mapping all possible
        models to their respective serializers.
        """
    voted_object = GenericRelatedField({
        Post: PostSerializer(),
    })

    class Meta:
        model = VotedItem
        fields = ('user', 'voted_object')
</code></pre>

<p>and models.py:</p>

<pre><code>from __future__ import unicode_literals

from datetime import datetime

from django.utils.encoding import python_2_unicode_compatible
from django.db import models
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse
from django.utils import timezone
from django.contrib.auth.models import User
from social_count.managers import VoteManager

SCORES = (
    (+1, '+1'),
    (-1, '-1'),
)

@python_2_unicode_compatible
class VotedItem(models.Model):
    """
    A vote on an object by a User.
    """
    user = models.ForeignKey(User)
    content_type = models.ForeignKey(
        ContentType,
        null=True,
        blank=True,
        on_delete=models.CASCADE,
    )
    object_id = models.PositiveIntegerField(        
        null=True,
    )
    content_object = GenericForeignKey('content_type', 'object_id')
    vote = models.SmallIntegerField(choices=SCORES, blank=True, null=True)
    flag = models.NullBooleanField(blank=True, null=True)
    timestamp = models.DateTimeField(auto_now=False, auto_now_add=True)

    objects = VoteManager()

    class Meta:
        db_table = 'votes'
        # One vote per user per object
        unique_together = (('user', 'content_type', 'object_id'),)

    def __str__(self):
        return '%s: %s on %s' % (self.user, self.vote, self.content_object)

    def is_upvote(self):
        return self.vote == 1

    def is_downvote(self):
        return self.vote == -1
</code></pre>

<p>When I visit www.mypage.com/likes/api/1/ I get an error message:</p>

<pre><code>Traceback:

File "/home/henry/newpine/src/env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  149.                     response = self.process_exception_by_middleware(e, request)

File "/home/henry/newpine/src/env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  147.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/home/henry/newpine/src/env/local/lib/python2.7/site-packages/django/views/decorators/csrf.py" in wrapped_view
  58.         return view_func(*args, **kwargs)

File "/home/henry/newpine/src/env/local/lib/python2.7/site-packages/django/views/generic/base.py" in view
  68.             return self.dispatch(request, *args, **kwargs)

File "/home/henry/newpine/src/env/local/lib/python2.7/site-packages/rest_framework/views.py" in dispatch
  466.             response = self.handle_exception(exc)

File "/home/henry/newpine/src/env/local/lib/python2.7/site-packages/rest_framework/views.py" in dispatch
  463.             response = handler(request, *args, **kwargs)

File "/home/henry/newpine/src/env/local/lib/python2.7/site-packages/rest_framework/generics.py" in get
  286.         return self.retrieve(request, *args, **kwargs)

File "/home/henry/newpine/src/env/local/lib/python2.7/site-packages/rest_framework/mixins.py" in retrieve
  57.         serializer = self.get_serializer(instance)

File "/home/henry/newpine/src/env/local/lib/python2.7/site-packages/rest_framework/generics.py" in get_serializer
  111.         return serializer_class(*args, **kwargs)

Exception Type: TypeError at /likes/api/1/
Exception Value: 'ListSerializer' object is not callable
</code></pre>