mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-02 20:54:42 +03:00
Don't use 'instance' argument in rendering form for paginated data. Closes #2205.
This commit is contained in:
parent
af3fe5a39f
commit
41bfdc0732
|
@ -12,6 +12,7 @@ import json
|
||||||
import django
|
import django
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
|
from django.core.paginator import Page
|
||||||
from django.http.multipartparser import parse_header
|
from django.http.multipartparser import parse_header
|
||||||
from django.template import Context, RequestContext, loader, Template
|
from django.template import Context, RequestContext, loader, Template
|
||||||
from django.test.client import encode_multipart
|
from django.test.client import encode_multipart
|
||||||
|
@ -533,6 +534,8 @@ class BrowsableAPIRenderer(BaseRenderer):
|
||||||
serializer = getattr(data, 'serializer', None)
|
serializer = getattr(data, 'serializer', None)
|
||||||
if serializer and not getattr(serializer, 'many', False):
|
if serializer and not getattr(serializer, 'many', False):
|
||||||
instance = getattr(serializer, 'instance', None)
|
instance = getattr(serializer, 'instance', None)
|
||||||
|
if isinstance(instance, Page):
|
||||||
|
instance = None
|
||||||
else:
|
else:
|
||||||
instance = None
|
instance = None
|
||||||
|
|
||||||
|
@ -591,6 +594,8 @@ class BrowsableAPIRenderer(BaseRenderer):
|
||||||
serializer = getattr(data, 'serializer', None)
|
serializer = getattr(data, 'serializer', None)
|
||||||
if serializer and not getattr(serializer, 'many', False):
|
if serializer and not getattr(serializer, 'many', False):
|
||||||
instance = getattr(serializer, 'instance', None)
|
instance = getattr(serializer, 'instance', None)
|
||||||
|
if isinstance(instance, Page):
|
||||||
|
instance = None
|
||||||
else:
|
else:
|
||||||
instance = None
|
instance = None
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user