From 41bfdc0732050d8b630eeae0a9c29a382ea33db5 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 8 Dec 2014 21:56:06 +0000 Subject: [PATCH] Don't use 'instance' argument in rendering form for paginated data. Closes #2205. --- rest_framework/renderers.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rest_framework/renderers.py b/rest_framework/renderers.py index 7c14ab8f2..cfcf1f5d0 100644 --- a/rest_framework/renderers.py +++ b/rest_framework/renderers.py @@ -12,6 +12,7 @@ import json import django from django import forms from django.core.exceptions import ImproperlyConfigured +from django.core.paginator import Page from django.http.multipartparser import parse_header from django.template import Context, RequestContext, loader, Template from django.test.client import encode_multipart @@ -533,6 +534,8 @@ class BrowsableAPIRenderer(BaseRenderer): serializer = getattr(data, 'serializer', None) if serializer and not getattr(serializer, 'many', False): instance = getattr(serializer, 'instance', None) + if isinstance(instance, Page): + instance = None else: instance = None @@ -591,6 +594,8 @@ class BrowsableAPIRenderer(BaseRenderer): serializer = getattr(data, 'serializer', None) if serializer and not getattr(serializer, 'many', False): instance = getattr(serializer, 'instance', None) + if isinstance(instance, Page): + instance = None else: instance = None