mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-25 23:50:01 +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
|
||||
|
||||
if existing_serializer is not None:
|
||||
try:
|
||||
with contextlib.suppress(TypeError):
|
||||
return self.render_form_for_serializer(existing_serializer)
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
if has_serializer:
|
||||
if method in ('PUT', 'PATCH'):
|
||||
serializer = view.get_serializer(instance=instance, **kwargs)
|
||||
|
|
Loading…
Reference in New Issue
Block a user