File tree Expand file tree Collapse file tree 3 files changed +19
-9
lines changed
templates/bootstrap_toolkit Expand file tree Collapse file tree 3 files changed +19
-9
lines changed Original file line number Diff line number Diff line change 62
62
* to Twitter for building and releasing Bootstrap
63
63
* to the Django community for Django
64
64
* to the authors of django-bootstrap-form for the inspiration
65
- * to Stefan Petre
65
+ * to Stefan Petre for the datepicker
Original file line number Diff line number Diff line change 1
1
{% spaceless %}
2
- {% if prepend %}
3
- < div class ="input-prepend "> < span class ="add-on "> {{ prepend }}</ span > {{ field }}</ div >
4
- {% else %}
5
- {% if append %}
6
- < div class ="input-append "> {{ field }}< span class ="add-on "> {{ append }}</ span > </ div >
2
+ {% comment %}
3
+ Spaceless is required here to make sure prepend and append work properly
4
+ {% endcomment %}
5
+ {% with prepend=prepend|default:field.field.widget.bootstrap.prepend append=append|default:field.field.widget.bootstrap.append %}
6
+ {% if prepend %}
7
+ < div class ="input-prepend "> < span class ="add-on "> {{ prepend }}</ span > {{ field }}</ div >
7
8
{% else %}
8
- {{ field }}
9
+ {% if append %}
10
+ < div class ="input-append "> {{ field }}< span class ="add-on "> {{ append }}</ span > </ div >
11
+ {% else %}
12
+ {{ field }}
13
+ {% endif %}
9
14
{% endif %}
10
- {% endif %}
11
- {% endspaceless %}
15
+ {% endwith %}
16
+ {% endspaceless %}
Original file line number Diff line number Diff line change @@ -21,6 +21,11 @@ def add_to_css_class(classes, new_class):
21
21
22
22
class BootstrapDateInput (forms .TextInput ):
23
23
24
+ bootstrap = {
25
+ 'append' : mark_safe ('<i class="icon-th"></i>' ),
26
+ 'prepend' : None ,
27
+ }
28
+
24
29
class Media :
25
30
js = (
26
31
settings .STATIC_URL + 'datepicker/js/bootstrap-datepicker.js' ,
You can’t perform that action at this time.
0 commit comments