diff --git a/docs/topics/html-and-forms.md b/docs/topics/html-and-forms.md index 0b4afca12..2bf955fda 100644 --- a/docs/topics/html-and-forms.md +++ b/docs/topics/html-and-forms.md @@ -92,7 +92,7 @@ The following view demonstrates an example of using a serializer in a template f The `render_form` tag takes an optional `template_pack` argument, that specifies which template directory should be used for rendering the form and form fields. -REST framework includes three built-in template packs, all based on Bootstrap 3. The built-in styles are `horizontal`, `vertical`, and `inline`. The default style is `horizontal`. To use any of these template packs you'll want to also include the Bootstrap 3 CSS. +REST framework includes three built-in template packs, all based on Bootstrap 3. The built-in styles are `horizontal`, `vertical`, and `inline`. The default style is `vertical`. To use any of these template packs you'll want to also include the Bootstrap 3 CSS. The following HTML will link to a CDN hosted version of the Bootstrap 3 CSS: @@ -144,13 +144,15 @@ Presents labels and controls alongside each other, using a 2/10 column split. *This is the form style used in the browsable API and admin renderers.* +Note: make sure you add "form-horizontal" class to `form` tag as per Bootstrap 3 guidelines. + {% load rest_framework %} ...
{% csrf_token %} - {% render_form serializer %} + {% render_form serializer template_pack='rest_framework/horizontal' %}
diff --git a/rest_framework/negotiation.py b/rest_framework/negotiation.py index ca1b59f12..31fe8b8e9 100644 --- a/rest_framework/negotiation.py +++ b/rest_framework/negotiation.py @@ -85,7 +85,9 @@ class DefaultContentNegotiation(BaseContentNegotiation): renderers = [renderer for renderer in renderers if renderer.format == format] if not renderers: - raise Http404 + raise Http404('Renderer for (%s) not found. Did you enable it with' + ' DEFAULT_RENDERER_CLASSES or within the APIView' + ' / ViewSet?' % format) return renderers def get_accept_list(self, request): diff --git a/rest_framework/views.py b/rest_framework/views.py index 70af84816..3e044382e 100644 --- a/rest_framework/views.py +++ b/rest_framework/views.py @@ -81,7 +81,7 @@ def exception_handler(exc, context): to be raised. """ if isinstance(exc, Http404): - exc = exceptions.NotFound() + exc = exceptions.NotFound(*exc.args) elif isinstance(exc, PermissionDenied): exc = exceptions.PermissionDenied()