mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-12-01 05:54:01 +03:00
Hide hidden fields
This commit is contained in:
parent
55317b0372
commit
7ad414cd60
|
@ -86,7 +86,7 @@
|
|||
<h2>POST {{ name }}</h2>
|
||||
{% csrf_token %}
|
||||
{{ post_form.non_field_errors }}
|
||||
{% for field in post_form %}
|
||||
{% for field in post_form.visible_fields %}
|
||||
<div class='form-row'>
|
||||
{{ field.label_tag }}
|
||||
{{ field }}
|
||||
|
@ -108,7 +108,7 @@
|
|||
<input type="hidden" name="{{ METHOD_PARAM }}" value="PUT" />
|
||||
{% csrf_token %}
|
||||
{{ put_form.non_field_errors }}
|
||||
{% for field in put_form %}
|
||||
{% for field in put_form.visible_fields %}
|
||||
<div class='form-row'>
|
||||
{{ field.label_tag }}
|
||||
{{ field }}
|
||||
|
|
|
@ -253,7 +253,8 @@ class View(ResourceMixin, RequestMixin, ResponseMixin, AuthMixin, DjangoView):
|
|||
if form is not None:
|
||||
field_name_types = {}
|
||||
for name, field in form.fields.iteritems():
|
||||
field_name_types[name] = field.__class__.__name__
|
||||
if not field.widget.is_hidden:
|
||||
field_name_types[name] = field.__class__.__name__
|
||||
response_obj['fields'] = field_name_types
|
||||
# Note 'ErrorResponse' is misleading, it's just any response
|
||||
# that should be rendered and returned immediately, without any
|
||||
|
|
Loading…
Reference in New Issue
Block a user