mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-11-04 18:08:03 +03:00 
			
		
		
		
	Moar form styling
This commit is contained in:
		
							parent
							
								
									22b27cbdc4
								
							
						
					
					
						commit
						e8ea365c15
					
				| 
						 | 
					@ -153,7 +153,7 @@
 | 
				
			||||||
                                    <div class="tab-pane" id="object-form">
 | 
					                                    <div class="tab-pane" id="object-form">
 | 
				
			||||||
                                        {% with form=post_form %}
 | 
					                                        {% with form=post_form %}
 | 
				
			||||||
                                            <form action="{{ request.get_full_path }}"
 | 
					                                            <form action="{{ request.get_full_path }}"
 | 
				
			||||||
                                                  method="POST" enctype="multipart/form-data" class="form-horizontal">
 | 
					                                                  method="POST" enctype="multipart/form-data" class="form-horizontal" novalidate>
 | 
				
			||||||
                                                <fieldset>
 | 
					                                                <fieldset>
 | 
				
			||||||
                                                    {{ post_form }}
 | 
					                                                    {{ post_form }}
 | 
				
			||||||
                                                    <div class="form-actions">
 | 
					                                                    <div class="form-actions">
 | 
				
			||||||
| 
						 | 
					@ -198,7 +198,7 @@
 | 
				
			||||||
                                {% if put_form %}
 | 
					                                {% if put_form %}
 | 
				
			||||||
                                    <div class="tab-pane" id="object-form">
 | 
					                                    <div class="tab-pane" id="object-form">
 | 
				
			||||||
                                        <form action="{{ request.get_full_path }}"
 | 
					                                        <form action="{{ request.get_full_path }}"
 | 
				
			||||||
                                              method="POST" enctype="multipart/form-data" class="form-horizontal">
 | 
					                                              method="POST" enctype="multipart/form-data" class="form-horizontal" novalidate>
 | 
				
			||||||
                                            <fieldset>
 | 
					                                            <fieldset>
 | 
				
			||||||
                                                {{ put_form }}
 | 
					                                                {{ put_form }}
 | 
				
			||||||
                                                <div class="form-actions">
 | 
					                                                <div class="form-actions">
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,9 +1,9 @@
 | 
				
			||||||
{% load rest_framework %}
 | 
					{% load rest_framework %}
 | 
				
			||||||
<form class="form-horizontal" role="form" action="." method="POST">
 | 
					<form class="form-horizontal" role="form" action="." method="POST" novalidate>
 | 
				
			||||||
    {% csrf_token %}
 | 
					    {% csrf_token %}
 | 
				
			||||||
    {% for field in form %}
 | 
					    {% for field in form %}
 | 
				
			||||||
        {% if not field.read_only %}
 | 
					        {% if not field.read_only %}
 | 
				
			||||||
            {% render_field field template_pack=template_pack renderer=renderer %}
 | 
					            {% render_field field style=style %}
 | 
				
			||||||
        {% endif %}
 | 
					        {% endif %}
 | 
				
			||||||
    {% endfor %}
 | 
					    {% endfor %}
 | 
				
			||||||
    <!-- form.non_field_errors -->
 | 
					    <!-- form.non_field_errors -->
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,7 +3,7 @@
 | 
				
			||||||
        <label class="col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}">{{ field.label }}</label>
 | 
					        <label class="col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}">{{ field.label }}</label>
 | 
				
			||||||
    {% endif %}
 | 
					    {% endif %}
 | 
				
			||||||
    <div class="col-sm-10">
 | 
					    <div class="col-sm-10">
 | 
				
			||||||
        <input name="{{ field.name }}" class="form-control" type="{{ style.input_type }}" novalidate {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if field.value %}value="{{ field.value }}"{% endif %}>
 | 
					        <input name="{{ field.name }}" class="form-control" type="{{ style.input_type }}" {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if field.value %}value="{{ field.value }}"{% endif %}>
 | 
				
			||||||
        {% if field.errors %}
 | 
					        {% if field.errors %}
 | 
				
			||||||
            {% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
 | 
					            {% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
 | 
				
			||||||
        {% endif %}
 | 
					        {% endif %}
 | 
				
			||||||
| 
						 | 
					@ -1,9 +1,9 @@
 | 
				
			||||||
{% load rest_framework %}
 | 
					{% load rest_framework %}
 | 
				
			||||||
<form class="form-inline" role="form" action="." method="POST">
 | 
					<form class="form-inline" role="form" action="." method="POST" novalidate>
 | 
				
			||||||
    {% csrf_token %}
 | 
					    {% csrf_token %}
 | 
				
			||||||
    {% for field in form %}
 | 
					    {% for field in form %}
 | 
				
			||||||
        {% if not field.read_only %}
 | 
					        {% if not field.read_only %}
 | 
				
			||||||
            {% render_field field template_pack=template_pack renderer=renderer %}
 | 
					            {% render_field field style=style %}
 | 
				
			||||||
        {% endif %}
 | 
					        {% endif %}
 | 
				
			||||||
    {% endfor %}
 | 
					    {% endfor %}
 | 
				
			||||||
    <!-- form.non_field_errors -->
 | 
					    <!-- form.non_field_errors -->
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,5 +2,5 @@
 | 
				
			||||||
    {% if field.label %}
 | 
					    {% if field.label %}
 | 
				
			||||||
        <label class="sr-only">{{ field.label }}</label>
 | 
					        <label class="sr-only">{{ field.label }}</label>
 | 
				
			||||||
    {% endif %}
 | 
					    {% endif %}
 | 
				
			||||||
    <input name="{{ field.name }}" class="form-control" type="{{ style.input_type }}" novalidate {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if field.value %}value="{{ field.value }}"{% endif %}>
 | 
					    <input name="{{ field.name }}" class="form-control" type="{{ style.input_type }}" {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if field.value %}value="{{ field.value }}"{% endif %}>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
| 
						 | 
					@ -1,9 +1,9 @@
 | 
				
			||||||
{% load rest_framework %}
 | 
					{% load rest_framework %}
 | 
				
			||||||
<form role="form" action="." method="POST">
 | 
					<form role="form" action="." method="POST" novalidate>
 | 
				
			||||||
    {% csrf_token %}
 | 
					    {% csrf_token %}
 | 
				
			||||||
    {% for field in form %}
 | 
					    {% for field in form %}
 | 
				
			||||||
        {% if not field.read_only %}
 | 
					        {% if not field.read_only %}
 | 
				
			||||||
            {% render_field field template_pack=template_pack renderer=renderer %}
 | 
					            {% render_field field style=style %}
 | 
				
			||||||
        {% endif %}
 | 
					        {% endif %}
 | 
				
			||||||
    {% endfor %}
 | 
					    {% endfor %}
 | 
				
			||||||
    <!-- form.non_field_errors -->
 | 
					    <!-- form.non_field_errors -->
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,7 @@
 | 
				
			||||||
    {% if field.label %}
 | 
					    {% if field.label %}
 | 
				
			||||||
        <label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label>
 | 
					        <label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label>
 | 
				
			||||||
    {% endif %}
 | 
					    {% endif %}
 | 
				
			||||||
    <input name="{{ field.name }}" class="form-control" type="{{ style.input_type }}" novalidate {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if field.value %}value="{{ field.value }}"{% endif %}>
 | 
					    <input name="{{ field.name }}" class="form-control" type="{{ style.input_type }}" {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if field.value %}value="{{ field.value }}"{% endif %}>
 | 
				
			||||||
    {% if field.errors %}
 | 
					    {% if field.errors %}
 | 
				
			||||||
        {% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
 | 
					        {% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
 | 
				
			||||||
    {% endif %}
 | 
					    {% endif %}
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user