  def is_simple_callable(obj):
      """
      True if the object is a callable that takes no arguments.
      """
      try:
          args, _, _, defaults = inspect.getargspec(obj)
      except TypeError:
          return False
      else:
          len_args = len(args) if inspect.isfunction(obj) else len(args) - 1
          len_defaults = len(defaults) if defaults else 0
          return len_args <= len_defaults
 
</s> remove     else:
        len_args = len(args) if inspect.isfunction(obj) else len(args) - 1
        len_defaults = len(defaults) if defaults else 0
        return len_args <= len_defaults
 </s> add     args, _, _, defaults = inspect.getargspec(obj)
    len_args = len(args) if function else len(args) - 1
    len_defaults = len(defaults) if defaults else 0
    return len_args <= len_defaults </s> remove         response = self.view(request).render()
 </s> add         # Note: Database queries are a `SELECT COUNT`, and `SELECT <fields>`
        with self.assertNumQueries(2):
            response = self.view(request).render() </s> remove         response = self.view(request).render()
 </s> add         with self.assertNumQueries(2):
            response = self.view(request).render() </s> remove         response = self.view(request).render()
 </s> add         with self.assertNumQueries(2):
            response = self.view(request).render()
    function = inspect.isfunction(obj)
    method = inspect.ismethod(obj)

    if not (function or method):
  def is_simple_callable(obj):
      """
      True if the object is a callable that takes no arguments.
      """
    function = inspect.isfunction(obj)
    method = inspect.ismethod(obj)

    if not (function or method):
    function = inspect.isfunction(obj)
    method = inspect.ismethod(obj)

    if not (function or method):
    function = inspect.isfunction(obj)
    method = inspect.ismethod(obj)

    if not (function or method):
          return False
      else:
          len_args = len(args) if inspect.isfunction(obj) else len(args) - 1
          len_defaults = len(defaults) if defaults else 0
          return len_args <= len_defaults
keep keep keep keep replace replace replace keep keep keep keep keep
 Fix duplicated database queries for paginated lists.

Closes #713. 
rest_framework/fields.py