Added child template for file inputs to get rid of outer white box

This commit is contained in:
Kevin Chang 2014-11-12 14:08:50 -08:00 committed by Kevin Chang
parent dbb435ca31
commit 70cf08a0a2
3 changed files with 8 additions and 1 deletions

View File

@ -375,7 +375,7 @@ class HTMLFormRenderer(BaseRenderer):
'input_type': 'time'
},
serializers.FileField: {
'base_template': 'input.html',
'base_template': 'file_input.html',
'input_type': 'file'
},
serializers.BooleanField: {

View File

@ -0,0 +1,5 @@
{% extends "rest_framework/horizontal/input.html" %}
{% block input %}
<input name="{{ field.name }}" type="{{ style.input_type }}" {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if field.value %}value="{{ field.value }}"{% endif %}>
{% endblock %}

View File

@ -3,7 +3,9 @@
<label class="col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}">{{ field.label }}</label>
{% endif %}
<div class="col-sm-10">
{% block input %}
<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 %}>
{% endblock %}
{% if field.errors %}
{% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
{% endif %}