Skip to content

Commit 5ed07c1

Browse files
committed
Merge branch 'release/5.0.0'
2 parents e69508b + 2002c41 commit 5ed07c1

File tree

14 files changed

+303
-130
lines changed

14 files changed

+303
-130
lines changed

.travis.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ python:
99

1010
# Django versions for matrix
1111
env:
12-
- DJANGO_VERSION=1.4.13
13-
- DJANGO_VERSION=1.5.8
14-
- DJANGO_VERSION=1.6.5
12+
- DJANGO_VERSION=1.4.16
13+
- DJANGO_VERSION=1.5.11
14+
- DJANGO_VERSION=1.6.8
15+
- DJANGO_VERSION=1.7.1
1516

1617
# Command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
1718
install:
@@ -22,21 +23,24 @@ install:
2223
script:
2324
- coverage run --source=bootstrap3 manage.py test
2425

25-
# Support Python3 only with Django 1.6
26+
# Support Python3 only with Django 1.6+
27+
# Support Django 1.7+ only with Python 2.7+
2628
matrix:
2729
exclude:
2830
- python: "3.2"
29-
env: DJANGO_VERSION=1.4.13
31+
env: DJANGO_VERSION=1.4.16
3032
- python: "3.3"
31-
env: DJANGO_VERSION=1.4.13
33+
env: DJANGO_VERSION=1.4.16
3234
- python: "3.4"
33-
env: DJANGO_VERSION=1.4.13
35+
env: DJANGO_VERSION=1.4.16
3436
- python: "3.2"
35-
env: DJANGO_VERSION=1.5.8
37+
env: DJANGO_VERSION=1.5.11
3638
- python: "3.3"
37-
env: DJANGO_VERSION=1.5.8
39+
env: DJANGO_VERSION=1.5.11
3840
- python: "3.4"
39-
env: DJANGO_VERSION=1.5.8
41+
env: DJANGO_VERSION=1.5.11
42+
- python: "2.6"
43+
env: DJANGO_VERSION=1.7.1
4044

4145
# Report to coveralls
4246
after_success:

HISTORY.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ History
44
-------
55

66

7+
5.0.0 (2014-11-21)
8+
++++++++++++++++++
9+
10+
* Bug fixes and update to Bootstrap 3.2.1
11+
12+
713
4.11.0 (2014-08-19)
814
+++++++++++++++++++
915

bootstrap3/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# -*- coding: utf-8 -*-
22

3-
__version__ = '4.11.0'
3+
__version__ = '5.0.0'

bootstrap3/bootstrap.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# Default settings
99
BOOTSTRAP3_DEFAULTS = {
1010
'jquery_url': '//code.jquery.com/jquery.min.js',
11-
'base_url': '//netdna.bootstrapcdn.com/bootstrap/3.2.0/',
11+
'base_url': '//netdna.bootstrapcdn.com/bootstrap/3.3.1/',
1212
'css_url': None,
1313
'theme_url': None,
1414
'javascript_url': None,
@@ -65,14 +65,16 @@ def javascript_url():
6565
"""
6666
Return the full url to the Bootstrap JavaScript file
6767
"""
68-
return get_bootstrap_setting('javascript_url') or bootstrap_url('js/bootstrap.min.js')
68+
return get_bootstrap_setting('javascript_url') or \
69+
bootstrap_url('js/bootstrap.min.js')
6970

7071

7172
def css_url():
7273
"""
7374
Return the full url to the Bootstrap CSS file
7475
"""
75-
return get_bootstrap_setting('css_url') or bootstrap_url('css/bootstrap.min.css')
76+
return get_bootstrap_setting('css_url') or \
77+
bootstrap_url('css/bootstrap.min.css')
7678

7779

7880
def theme_url():
@@ -102,4 +104,3 @@ def get_form_renderer(**kwargs):
102104
def get_field_renderer(**kwargs):
103105
renderers = get_bootstrap_setting('field_renderers')
104106
return get_renderer(renderers, **kwargs)
105-

bootstrap3/components.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ def render_alert(content, alert_type=None, dismissable=True):
2828
css_classes = ['alert', 'alert-' + text_value(alert_type)]
2929
if dismissable:
3030
css_classes.append('alert-dismissable')
31-
button = '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>'
31+
button = '<button type="button" class="close" ' + \
32+
'data-dismiss="alert" aria-hidden="true">&times;</button>'
3233
return '<div class="{css_classes}">{button}{content}</div>'.format(
3334
css_classes=' '.join(css_classes),
3435
button=button,

bootstrap3/forms.py

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22
from __future__ import unicode_literals
33

44
from django.contrib.admin.widgets import AdminFileWidget
5-
from django.forms import HiddenInput, FileInput, CheckboxSelectMultiple, Textarea, TextInput
6-
7-
from .bootstrap import get_bootstrap_setting, get_form_renderer, get_field_renderer, get_formset_renderer
5+
from django.forms import (
6+
HiddenInput, FileInput, CheckboxSelectMultiple, Textarea, TextInput
7+
)
8+
9+
from .bootstrap import (
10+
get_bootstrap_setting, get_form_renderer, get_field_renderer,
11+
get_formset_renderer
12+
)
813
from .text import text_concat, text_value
914
from .exceptions import BootstrapError
1015
from .html import add_css_class, render_tag
@@ -38,7 +43,7 @@ def render_form(form, **kwargs):
3843
return renderer_cls(form, **kwargs).render()
3944

4045

41-
def render_form_errors(form, layout='', type='all', **kwargs):
46+
def render_form_errors(form, type='all', **kwargs):
4247
"""
4348
Render form errors to a Bootstrap layout
4449
"""
@@ -68,7 +73,9 @@ def render_label(content, label_for=None, label_class=None, label_title=''):
6873
return render_tag('label', attrs=attrs, content=content)
6974

7075

71-
def render_button(content, button_type=None, icon=None, button_class='', size='', href=''):
76+
def render_button(
77+
content, button_type=None, icon=None, button_class='', size='',
78+
href=''):
7279
"""
7380
Render a button with content
7481
"""
@@ -84,12 +91,16 @@ def render_button(content, button_type=None, icon=None, button_class='', size=''
8491
elif size == 'md' or size == 'medium':
8592
pass
8693
elif size:
87-
raise BootstrapError('Parameter "size" should be "xs", "sm", "lg" or empty ("{}" given).'.format(size))
94+
raise BootstrapError(
95+
'Parameter "size" should be "xs", "sm", "lg" or ' +
96+
'empty ("{}" given).'.format(size))
8897
if button_type:
8998
if button_type == 'submit':
9099
classes = add_css_class(classes, 'btn-primary')
91100
elif button_type not in ('reset', 'button', 'link'):
92-
raise BootstrapError('Parameter "button_type" should be "submit", "reset", "button", "link" or empty ("{}" given).'.format(button_type))
101+
raise BootstrapError(
102+
'Parameter "button_type" should be "submit", "reset", ' +
103+
'"button", "link" or empty ("{}" given).'.format(button_type))
93104
attrs['type'] = button_type
94105
attrs['class'] = classes
95106
icon_content = render_icon(icon) if icon else ''
@@ -98,10 +109,14 @@ def render_button(content, button_type=None, icon=None, button_class='', size=''
98109
tag = 'a'
99110
else:
100111
tag = 'button'
101-
return render_tag(tag, attrs=attrs, content=text_concat(icon_content, content, separator=' '))
112+
return render_tag(
113+
tag, attrs=attrs, content=text_concat(
114+
icon_content, content, separator=' '))
102115

103116

104-
def render_field_and_label(field, label, field_class='', label_for=None, label_class='', layout='', **kwargs):
117+
def render_field_and_label(
118+
field, label, field_class='', label_for=None, label_class='',
119+
layout='', **kwargs):
105120
"""
106121
Render a field with its label
107122
"""
@@ -115,9 +130,11 @@ def render_field_and_label(field, label, field_class='', label_for=None, label_c
115130
label_class = add_css_class(label_class, 'control-label')
116131
html = field
117132
if field_class:
118-
html = '<div class="{klass}">{html}</div>'.format(klass=field_class, html=html)
133+
html = '<div class="{klass}">{html}</div>'.format(
134+
klass=field_class, html=html)
119135
if label:
120-
html = render_label(label, label_for=label_for, label_class=label_class) + html
136+
html = render_label(
137+
label, label_for=label_for, label_class=label_class) + html
121138
return html
122139

123140

@@ -139,7 +156,10 @@ def is_widget_required_attribute(widget):
139156
return False
140157
if not widget.is_required:
141158
return False
142-
if isinstance(widget, (AdminFileWidget, HiddenInput, FileInput, CheckboxSelectMultiple)):
159+
if isinstance(
160+
widget, (
161+
AdminFileWidget, HiddenInput, FileInput,
162+
CheckboxSelectMultiple)):
143163
return False
144164
return True
145165

@@ -151,4 +171,3 @@ def is_widget_with_placeholder(widget):
151171
These are all derived form TextInput, except for Textarea
152172
"""
153173
return isinstance(widget, (TextInput, Textarea))
154-

bootstrap3/html.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ def add_css_class(css_classes, css_class, prepend=False):
2222
Add a CSS class to a string of CSS classes
2323
"""
2424
classes_list = split_css_classes(css_classes)
25-
classes_to_add = [c for c in split_css_classes(css_class) if c not in classes_list]
25+
classes_to_add = [c for c in split_css_classes(css_class)
26+
if c not in classes_list]
2627
if prepend:
2728
classes_list = classes_to_add + classes_list
2829
else:
@@ -35,15 +36,19 @@ def remove_css_class(css_classes, css_class):
3536
Remove a CSS class from a string of CSS classes
3637
"""
3738
remove = set(split_css_classes(css_class))
38-
classes_list = [c for c in split_css_classes(css_classes) if c not in remove]
39+
classes_list = [c for c in split_css_classes(css_classes)
40+
if c not in remove]
3941
return ' '.join(classes_list)
4042

4143

4244
def render_link_tag(url, rel='stylesheet', media='all'):
4345
"""
4446
Build a link tag
4547
"""
46-
return render_tag('link', attrs={'href': url, 'rel': rel, 'media': media}, close=False)
48+
return render_tag(
49+
'link',
50+
attrs={'href': url, 'rel': rel, 'media': media},
51+
close=False)
4752

4853

4954
def render_tag(tag, attrs=None, content=None, close=True):

0 commit comments

Comments
 (0)