mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-27 00:19:53 +03:00
replace try/except with context manager
This commit is contained in:
parent
7e95987bfd
commit
573df163fc
|
@ -487,11 +487,8 @@ class BrowsableAPIRenderer(BaseRenderer):
|
||||||
return
|
return
|
||||||
|
|
||||||
if existing_serializer is not None:
|
if existing_serializer is not None:
|
||||||
try:
|
with contextlib.suppress(TypeError):
|
||||||
return self.render_form_for_serializer(existing_serializer)
|
return self.render_form_for_serializer(existing_serializer)
|
||||||
except TypeError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if has_serializer:
|
if has_serializer:
|
||||||
if method in ('PUT', 'PATCH'):
|
if method in ('PUT', 'PATCH'):
|
||||||
serializer = view.get_serializer(instance=instance, **kwargs)
|
serializer = view.get_serializer(instance=instance, **kwargs)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user