Skip to content

Commit

Permalink
Use a lazy import for django.test.client.encode_mutlipart. Closes #7078
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchristie committed Dec 12, 2019
1 parent aa087ff commit 4130f01
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rest_framework/renderers.py
Expand Up @@ -16,7 +16,6 @@
from django.core.paginator import Page
from django.http.multipartparser import parse_header
from django.template import engines, loader
from django.test.client import encode_multipart
from django.urls import NoReverseMatch
from django.utils.html import mark_safe

Expand Down Expand Up @@ -902,6 +901,8 @@ class MultiPartRenderer(BaseRenderer):
BOUNDARY = 'BoUnDaRyStRiNg'

def render(self, data, accepted_media_type=None, renderer_context=None):
from django.test.client import encode_multipart

if hasattr(data, 'items'):
for key, value in data.items():
assert not isinstance(value, dict), (
Expand Down

0 comments on commit 4130f01

Please sign in to comment.