diff options
| author | Tom Christie | 2014-11-20 16:14:51 +0000 |
|---|---|---|
| committer | Tom Christie | 2014-11-20 16:14:51 +0000 |
| commit | 5b671cb515cf49bc0335bdaa7ca0759827eb844d (patch) | |
| tree | c84796d7799dfc193ad87272333ed802bb25a7da | |
| parent | d037c53b57cc4777ab6ccf94a241eca0cffa2a36 (diff) | |
| download | django-rest-framework-5b671cb515cf49bc0335bdaa7ca0759827eb844d.tar.bz2 | |
Fix rendering HTML form when API error raised. Closes #2103.3.0-beta
| -rw-r--r-- | rest_framework/renderers.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/rest_framework/renderers.py b/rest_framework/renderers.py index a9885d3e..e87d16d0 100644 --- a/rest_framework/renderers.py +++ b/rest_framework/renderers.py @@ -525,7 +525,10 @@ class BrowsableAPIRenderer(BaseRenderer): else: instance = None - if request.method == method: + # If this is valid serializer data, and the form is for the same + # HTTP method as was used in the request then use the existing + # serializer instance, rather than dynamically creating a new one. + if request.method == method and serializer is not None: try: data = request.data except ParseError: |
