File tree Expand file tree Collapse file tree 3 files changed +17
-10
lines changed
bootstrap_toolkit/templatetags
demo_project/demo_app/templates Expand file tree Collapse file tree 3 files changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -44,22 +44,26 @@ def bootstrap_stylesheet_tag():
44
44
return u'<link rel="stylesheet" href="%s">' % bootstrap_stylesheet_url ()
45
45
46
46
@register .simple_tag
47
- def bootstrap_javascript_url (name ):
47
+ def bootstrap_javascript_url (name = None ):
48
48
"""
49
49
URL to Bootstrap javascript file
50
50
"""
51
51
if BOOTSTRAP_JS_URL :
52
52
return BOOTSTRAP_JS_URL
53
- return BOOTSTRAP_JS_BASE_URL + 'bootstrap-' + name + '.js'
54
-
53
+ if name :
54
+ return BOOTSTRAP_JS_BASE_URL + 'bootstrap-' + name + '.js'
55
+ else :
56
+ return BOOTSTRAP_JS_BASE_URL + 'bootstrap.min.js'
55
57
56
58
@register .simple_tag
57
- def bootstrap_javascript_tag (name ):
59
+ def bootstrap_javascript_tag (name = None ):
58
60
"""
59
61
HTML tag to insert bootstrap_toolkit javascript file
60
62
"""
61
-
62
- return u'<script src="%s"></script>' % bootstrap_javascript_url (name )
63
+ url = bootstrap_javascript_url (name )
64
+ if url :
65
+ return u'<script src="%s"></script>' % url
66
+ return u''
63
67
64
68
@register .filter
65
69
def as_bootstrap (form_or_field , layout = 'vertical,false' ):
@@ -203,3 +207,7 @@ def split(str, splitter):
203
207
Split a string
204
208
"""
205
209
return str .split (splitter )
210
+
211
+ @register .simple_tag (takes_context = True )
212
+ def bootstrap_messages (context , * args , ** kwargs ):
213
+ return get_template ("bootstrap_toolkit/messages.html" ).render (context )
Original file line number Diff line number Diff line change 16
16
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
17
17
<![endif]-->
18
18
< script src ="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js "> </ script >
19
- {% bootstrap_javascript_tag "dropdown" %}
20
- {% bootstrap_javascript_tag "alert" %}
19
+ {% bootstrap_javascript_tag %}
21
20
{% block extra_head %}{% endblock %}
22
21
</ head >
23
22
50
49
51
50
< div class ="container ">
52
51
53
- {% include "bootstrap_toolkit/messages.html" %}
52
+ {% bootstrap_messages %}
54
53
55
54
{% block content %}Empty page{% endblock %}
56
55
Original file line number Diff line number Diff line change 2
2
3
3
setup (
4
4
name = 'django-bootstrap-toolkit' ,
5
- version = '2.6.24 ' ,
5
+ version = '2.7.0 ' ,
6
6
url = 'https://github.com/dyve/django-bootstrap-toolkit' ,
7
7
author = 'Dylan Verheul' ,
8
8
You can’t perform that action at this time.
0 commit comments