新增:打包编译功能
This commit is contained in:
18
backend/templates/rest_framework/vertical/checkbox.html
Normal file
18
backend/templates/rest_framework/vertical/checkbox.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<div class="form-group {% if field.errors %}has-error{% endif %}">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="{{ field.name }}" value="true" {% if field.value %}checked{% endif %}>
|
||||
{% if field.label %}{{ field.label }}{% endif %}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
{% if field.errors %}
|
||||
{% for error in field.errors %}
|
||||
<span class="help-block">{{ error }}</span>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if field.help_text %}
|
||||
<span class="help-block">{{ field.help_text|safe }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -0,0 +1,37 @@
|
||||
{% load rest_framework %}
|
||||
|
||||
<div class="form-group {% if field.errors %}has-error{% endif %}">
|
||||
{% if field.label %}
|
||||
<label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label>
|
||||
{% endif %}
|
||||
|
||||
{% if style.inline %}
|
||||
<div>
|
||||
{% for key, text in field.choices|items %}
|
||||
<label class="checkbox-inline">
|
||||
<input type="checkbox" name="{{ field.name }}" value="{{ key }}" {% if key|as_string in field.value|as_list_of_strings %}checked{% endif %}>
|
||||
{{ text }}
|
||||
</label>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
{% for key, text in field.choices|items %}
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="{{ field.name }}" value="{{ key }}" {% if key|as_string in field.value|as_list_of_strings %}checked{% endif %}>
|
||||
{{ text }}
|
||||
</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if field.errors %}
|
||||
{% for error in field.errors %}
|
||||
<span class="help-block">{{ error }}</span>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if field.help_text %}
|
||||
<span class="help-block">{{ field.help_text|safe }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
<div class="form-group">
|
||||
{% if field.label %}
|
||||
<label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label>
|
||||
{% endif %}
|
||||
|
||||
<p class="form-control-static">Dictionaries are not currently supported in HTML input.</p>
|
||||
</div>
|
||||
15
backend/templates/rest_framework/vertical/fieldset.html
Normal file
15
backend/templates/rest_framework/vertical/fieldset.html
Normal file
@@ -0,0 +1,15 @@
|
||||
{% load rest_framework %}
|
||||
|
||||
<fieldset>
|
||||
{% if field.label %}
|
||||
<legend {% if style.hide_label %}class="sr-only"{% endif %}>
|
||||
{{ field.label }}
|
||||
</legend>
|
||||
{% endif %}
|
||||
|
||||
{% for nested_field in field %}
|
||||
{% if not nested_field.read_only %}
|
||||
{% render_field nested_field style=style %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</fieldset>
|
||||
6
backend/templates/rest_framework/vertical/form.html
Normal file
6
backend/templates/rest_framework/vertical/form.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{% load rest_framework %}
|
||||
{% for field in form %}
|
||||
{% if not field.read_only %}
|
||||
{% render_field field style=style %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
17
backend/templates/rest_framework/vertical/input.html
Normal file
17
backend/templates/rest_framework/vertical/input.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<div class="form-group {% if field.errors %}has-error{% endif %}">
|
||||
{% if field.label %}
|
||||
<label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label>
|
||||
{% endif %}
|
||||
|
||||
<input name="{{ field.name }}" {% if style.input_type != "file" %}class="form-control"{% endif %} type="{{ style.input_type }}" {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if field.value is not None %}value="{{ field.value }}"{% endif %} {% if style.autofocus and style.input_type != "hidden" %}autofocus{% endif %}>
|
||||
|
||||
{% if field.errors %}
|
||||
{% for error in field.errors %}
|
||||
<span class="help-block">{{ error }}</span>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if field.help_text %}
|
||||
<span class="help-block">{{ field.help_text|safe }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
<div class="form-group">
|
||||
{% if field.label %}
|
||||
<label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label>
|
||||
{% endif %}
|
||||
|
||||
<p class="form-control-static">Lists are not currently supported in HTML input.</p>
|
||||
</div>
|
||||
@@ -0,0 +1,9 @@
|
||||
<fieldset>
|
||||
{% if field.label %}
|
||||
<legend {% if style.hide_label %}class="sr-only"{% endif %}>
|
||||
{{ field.label }}
|
||||
</legend>
|
||||
{% endif %}
|
||||
|
||||
<p>Lists are not currently supported in HTML input.</p>
|
||||
</fieldset>
|
||||
57
backend/templates/rest_framework/vertical/radio.html
Normal file
57
backend/templates/rest_framework/vertical/radio.html
Normal file
@@ -0,0 +1,57 @@
|
||||
{% load i18n %}
|
||||
{% load rest_framework %}
|
||||
{% trans "None" as none_choice %}
|
||||
|
||||
<div class="form-group {% if field.errors %}has-error{% endif %}">
|
||||
{% if field.label %}
|
||||
<label {% if style.hide_label %}class="sr-only"{% endif %}>
|
||||
{{ field.label }}
|
||||
</label>
|
||||
{% endif %}
|
||||
|
||||
{% if style.inline %}
|
||||
<div>
|
||||
{% if field.allow_null or field.allow_blank %}
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="{{ field.name }}" value="" {% if not field.value %}checked{% endif %} />
|
||||
{{ none_choice }}
|
||||
</label>
|
||||
{% endif %}
|
||||
|
||||
{% for key, text in field.choices|items %}
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="{{ field.name }}" value="{{ key }}" {% if key|as_string == field.value|as_string %}checked{% endif %}>
|
||||
{{ text }}
|
||||
</label>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
{% if field.allow_null or field.allow_blank %}
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="{{ field.name }}" value="" {% if not field.value %}checked{% endif %} />
|
||||
{{ none_choice }}
|
||||
</label>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% for key, text in field.choices|items %}
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="{{ field.name }}" value="{{ key }}" {% if key|as_string == field.value|as_string %}checked{% endif %}>
|
||||
{{ text }}
|
||||
</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if field.errors %}
|
||||
{% for error in field.errors %}
|
||||
<span class="help-block">{{ error }}</span>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if field.help_text %}
|
||||
<span class="help-block">{{ field.help_text|safe }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
34
backend/templates/rest_framework/vertical/select.html
Normal file
34
backend/templates/rest_framework/vertical/select.html
Normal file
@@ -0,0 +1,34 @@
|
||||
{% load rest_framework %}
|
||||
|
||||
<div class="form-group {% if field.errors %}has-error{% endif %}">
|
||||
{% if field.label %}
|
||||
<label {% if style.hide_label %}class="sr-only"{% endif %}>
|
||||
{{ field.label }}
|
||||
</label>
|
||||
{% endif %}
|
||||
|
||||
<select class="form-control" name="{{ field.name }}">
|
||||
{% if field.allow_null or field.allow_blank %}
|
||||
<option value="" {% if not field.value %}selected{% endif %}>--------</option>
|
||||
{% endif %}
|
||||
{% for select in field.iter_options %}
|
||||
{% if select.start_option_group %}
|
||||
<optgroup label="{{ select.label }}">
|
||||
{% elif select.end_option_group %}
|
||||
</optgroup>
|
||||
{% else %}
|
||||
<option value="{{ select.value }}" {% if select.value|as_string == field.value|as_string %}selected{% endif %} {% if select.disabled %}disabled{% endif %}>{{ select.display_text }}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
{% if field.errors %}
|
||||
{% for error in field.errors %}
|
||||
<span class="help-block">{{ error }}</span>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if field.help_text %}
|
||||
<span class="help-block">{{ field.help_text|safe }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -0,0 +1,33 @@
|
||||
{% load i18n %}
|
||||
{% load rest_framework %}
|
||||
{% trans "No items to select." as no_items %}
|
||||
|
||||
<div class="form-group {% if field.errors %}has-error{% endif %}">
|
||||
{% if field.label %}
|
||||
<label {% if style.hide_label %}class="sr-only"{% endif %}>
|
||||
{{ field.label }}
|
||||
</label>
|
||||
{% endif %}
|
||||
|
||||
<select multiple {{ field.choices|yesno:",disabled" }} class="form-control" name="{{ field.name }}">
|
||||
{% for select in field.iter_options %}
|
||||
{% if select.start_option_group %}
|
||||
<optgroup label="{{ select.label }}">
|
||||
{% elif select.end_option_group %}
|
||||
</optgroup>
|
||||
{% else %}
|
||||
<option value="{{ select.value }}" {% if select.value|as_string in field.value|as_list_of_strings %}selected{% endif %} {% if select.disabled %}disabled{% endif %}>{{ select.display_text }}</option>
|
||||
{% endif %}
|
||||
{% empty %}
|
||||
<option>{{ no_items }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
{% if field.errors %}
|
||||
{% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if field.help_text %}
|
||||
<span class="help-block">{{ field.help_text|safe }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
17
backend/templates/rest_framework/vertical/textarea.html
Normal file
17
backend/templates/rest_framework/vertical/textarea.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<div class="form-group {% if field.errors %}has-error{% endif %}">
|
||||
{% if field.label %}
|
||||
<label {% if style.hide_label %}class="sr-only"{% endif %}>
|
||||
{{ field.label }}
|
||||
</label>
|
||||
{% endif %}
|
||||
|
||||
<textarea name="{{ field.name }}" class="form-control" {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if style.rows %}rows="{{ style.rows }}"{% endif %}>{% if field.value %}{{ field.value }}{% endif %}</textarea>
|
||||
|
||||
{% if field.errors %}
|
||||
{% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if field.help_text %}
|
||||
<span class="help-block">{{ field.help_text|safe }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
Reference in New Issue
Block a user