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 7c14ab8f2d..cfcf1f5d05 100644 --- a/rest_framework/renderers.py +++ b/rest_framework/renderers.py @@ -12,6 +12,7 @@ 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 @@ def get_rendered_html_form(self, data, view, method, request): 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 @@ def get_raw_data_form(self, data, view, method, request): 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