Merge branch 'eureka' of https://github.com/caumons/django-bootstrap-form into caumons-eureka
Conflicts: .gitignore
This commit is contained in:
commit
a15b054d0a
2
.gitignore
vendored
2
.gitignore
vendored
@ -4,3 +4,5 @@
|
||||
docs/_build
|
||||
/build
|
||||
/dist
|
||||
|
||||
>>>>>>> aee2b719b27498f1b3dcbb1909a8443ff6d1cf9f
|
||||
|
@ -5,12 +5,12 @@
|
||||
<div class="{{ classes.single_value }}">
|
||||
<div class="checkbox">
|
||||
{% if field.auto_id %}
|
||||
<label>
|
||||
{{ field }} <span>{{ field.label }}</span>
|
||||
</label>
|
||||
<label {% if field.field.required and form.required_css_class %}class="{{ form.required_css_class }}"{% endif %}>
|
||||
{{ field }} <span>{{ field.label }}</span>
|
||||
</label>
|
||||
{% endif %}
|
||||
{% for error in field.errors %}
|
||||
<span class="help-block">{{ error }}</span>
|
||||
<span class="help-block {{ form.error_css_class }}">{{ error }}</span>
|
||||
{% endfor %}
|
||||
|
||||
{% if field.help_text %}
|
||||
@ -20,9 +20,9 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% else %}{% if field|is_radio %}
|
||||
{% elif field|is_radio %}
|
||||
{% if field.auto_id %}
|
||||
<label class="control-label {{ classes.label }}">{{ field.label }}</label>
|
||||
<label class="control-label {{ classes.label }} {% if field.field.required %}{{ form.required_css_class }}{% endif %}">{{ field.label }}</label>
|
||||
{% endif %}
|
||||
<div class="{{ classes.value }}">
|
||||
{% for choice in field %}
|
||||
@ -35,7 +35,7 @@
|
||||
{% endfor %}
|
||||
|
||||
{% for error in field.errors %}
|
||||
<span class="help-block">{{ error }}</span>
|
||||
<span class="help-block {{ form.error_css_class }}">{{ error }}</span>
|
||||
{% endfor %}
|
||||
|
||||
{% if field.help_text %}
|
||||
@ -44,16 +44,16 @@
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% else %}
|
||||
{% if field.auto_id %}
|
||||
<label class="control-label {{ classes.label }}" for="{{ field.auto_id }}">{{ field.label }}</label>
|
||||
<label class="control-label {{ classes.label }} {% if field.field.required %}{{ form.required_css_class }}{% endif %}" for="{{ field.auto_id }}">{{ field.label }}</label>
|
||||
{% endif %}
|
||||
<div class="{{ classes.value }}">
|
||||
|
||||
<div class="{{ classes.value }} {% if field|is_multiple_checkbox %}multiple-checkbox{% endif %}">
|
||||
{{ field }}
|
||||
|
||||
{% for error in field.errors %}
|
||||
<span class="help-block">{{ error }}</span>
|
||||
<span class="help-block {{ form.error_css_class }}">{{ error }}</span>
|
||||
{% endfor %}
|
||||
|
||||
{% if field.help_text %}
|
||||
@ -62,5 +62,5 @@
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
@ -48,7 +48,8 @@ def bootstrap_horizontal(element, label_cols={}):
|
||||
|
||||
|
||||
def add_input_classes(field):
|
||||
if not is_checkbox(field) and not is_multiple_checkbox(field) and not is_radio(field):
|
||||
if not is_checkbox(field) and not is_multiple_checkbox(field) and not is_radio(field) \
|
||||
and not is_file(field):
|
||||
field_classes = field.field.widget.attrs.get('class', '')
|
||||
field_classes += ' form-control'
|
||||
field.field.widget.attrs['class'] = field_classes
|
||||
@ -93,3 +94,8 @@ def is_multiple_checkbox(field):
|
||||
@register.filter
|
||||
def is_radio(field):
|
||||
return field.field.widget.__class__.__name__.lower() == "radioselect"
|
||||
|
||||
|
||||
@register.filter
|
||||
def is_file(field):
|
||||
return field.field.widget.__class__.__name__.lower() == "clearablefileinput"
|
||||
|
@ -6,6 +6,12 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css">
|
||||
<title>Bootstrap form example</title>
|
||||
<style type="text/css">
|
||||
.multiple-checkbox ul { /* Used to hide <li> elements in multiple checkbox forms */
|
||||
padding-left: 0px;
|
||||
list-style: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
Loading…
Reference in New Issue
Block a user