Skip to content

Commit 0e83d9d

Browse files
committed
Merge branch 'release/8.2.3'
2 parents 8b480aa + 763f7ce commit 0e83d9d

File tree

12 files changed

+111
-75
lines changed

12 files changed

+111
-75
lines changed

.travis.yml

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,18 @@
1-
# We do not use sudo
21
sudo: false
3-
4-
# Python versions for matrix
52
language: python
6-
python:
7-
- "2.7"
8-
- "3.2"
9-
- "3.3"
10-
- "3.4"
11-
- "3.5"
12-
- "3.6"
133

14-
# Django versions for matrix
15-
env:
16-
- DJANGO_VERSION='>=1.8,<1.9'
17-
- DJANGO_VERSION='>=1.9,<1.10'
18-
- DJANGO_VERSION='>=1.10,<1.11'
4+
python:
5+
- "2.7"
6+
- "3.3"
7+
- "3.4"
8+
- "3.5"
9+
- "3.6"
1910

20-
# Command to install dependencies, e.g. pip install -r requirements.txt
2111
install:
22-
- pip install Django$DJANGO_VERSION
23-
# Coverage 4.0 no longer supports py32. Install an older version before
24-
# coveralls tries to install the latest
25-
- if [[ $TRAVIS_PYTHON_VERSION == '3.2' ]]; then travis_retry pip install 'coverage<4.0'; fi
26-
- pip install coveralls
12+
- pip install tox-travis coveralls
2713

28-
# Command to run tests, e.g. python setup.py test
2914
script:
30-
- coverage run --source=bootstrap3 manage.py test
31-
32-
matrix:
33-
exclude:
34-
- python: "3.2"
35-
env: DJANGO_VERSION='>=1.9,<1.10'
36-
- python: "3.2"
37-
env: DJANGO_VERSION='>=1.10,<1.11'
38-
- python: "3.3"
39-
env: DJANGO_VERSION='>=1.9,<1.10'
40-
- python: "3.3"
41-
env: DJANGO_VERSION='>=1.10,<1.11'
15+
- tox
4216

43-
# Report to coveralls
4417
after_success:
45-
- coveralls
18+
- coveralls

HISTORY.rst

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,20 @@ History
44
-------
55

66

7-
8.2.2 (017-04-03)
8-
+++++++++++++++++
7+
8.2.3 (2017-05-05)
8+
++++++++++++++++++
9+
10+
* Renamed requirements.txt to requirements-dev.txt
11+
* Tweaks to tests and CI (see #400)
12+
* Prepared test for geometry fields (disabled, blocked by Django update, see #392)
13+
* Bug fixes for add ons and placeholders (thanks @jaimesanz, @cybojenix and @marc-gist)
14+
* Improve documentation for pagination with GET parameters (thanks @nspo)
15+
* Add unicode test for help_text
16+
* Removed tests for Python 3.2 from tox and Travis CI (no longer supported by Django 1.8)
17+
18+
19+
8.2.2 (2017-04-03)
20+
++++++++++++++++++
921

1022
* Fix invalid HTML in help texts (thanks @luksen)
1123
* Added `mark_safe` to placeholder (thanks @ppo)

README.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ Write Django as usual, and let ``django-bootstrap3`` make template output into B
2323
Requirements
2424
------------
2525

26-
- Python 2.7, 3.2, 3.3, 3.4, or 3.5
26+
- Python 2.7, 3.3, 3.4, or 3.5
2727
- Django >= 1.8
28+
- For details, see https://docs.djangoproject.com/en/dev/faq/install/#faq-python-version-support
2829

2930
*The latest version supporting Python 2.6 and Django < 1.8 is the 6.x.x branch.*
3031

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__ = '8.2.2'
3+
__version__ = '8.2.3'

bootstrap3/bootstrap.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,16 @@ def javascript_url():
7777
"""
7878
Return the full url to the Bootstrap JavaScript file
7979
"""
80-
return get_bootstrap_setting('javascript_url') or \
81-
bootstrap_url('js/bootstrap.min.js')
80+
url = get_bootstrap_setting('javascript_url')
81+
return url if url else bootstrap_url('js/bootstrap.min.js')
8282

8383

8484
def css_url():
8585
"""
8686
Return the full url to the Bootstrap CSS file
8787
"""
88-
return get_bootstrap_setting('css_url') or \
89-
bootstrap_url('css/bootstrap.min.css')
88+
url = get_bootstrap_setting('css_url')
89+
return url if url else bootstrap_url('css/bootstrap.min.css')
9090

9191

9292
def theme_url():

bootstrap3/forms.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from django.contrib.admin.widgets import AdminFileWidget
55
from django.forms import (
66
HiddenInput, FileInput, CheckboxSelectMultiple, Textarea, TextInput,
7-
PasswordInput
7+
PasswordInput, NumberInput, EmailInput, URLInput,
88
)
99
from django.forms.widgets import CheckboxInput
1010
from django.utils.safestring import mark_safe
@@ -179,8 +179,6 @@ def is_widget_with_placeholder(widget):
179179
"""
180180
Is this a widget that should have a placeholder?
181181
Only text, search, url, tel, e-mail, password, number have placeholders
182-
These are all derived form TextInput, except for Textarea
183182
"""
184-
# PasswordInput inherits from Input in Django 1.4.
185-
# It was changed to inherit from TextInput in 1.5.
186-
return isinstance(widget, (TextInput, Textarea, PasswordInput))
183+
return isinstance(widget, (TextInput, Textarea, NumberInput, EmailInput,
184+
URLInput, PasswordInput))

bootstrap3/renderers.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
ReadOnlyPasswordHashWidget = None
99

1010
from django.forms import (
11-
TextInput, DateInput, FileInput, CheckboxInput, MultiWidget,
12-
ClearableFileInput, Select, RadioSelect, CheckboxSelectMultiple
11+
TextInput, DateInput, FileInput, CheckboxInput, MultiWidget, ClearableFileInput,
12+
Select, RadioSelect, CheckboxSelectMultiple, NumberInput, EmailInput, URLInput
1313
)
1414
# Django 1.9 moved SelectDateWidget to django.forms.widget from
1515
# django.forms.extras. Django 2.0 will remove the old import location.
@@ -443,7 +443,8 @@ def wrap_widget(self, html):
443443
return html
444444

445445
def make_input_group(self, html):
446-
if (self.addon_before or self.addon_after) and isinstance(self.widget, (TextInput, DateInput, Select)):
446+
if (self.addon_before or self.addon_after) and isinstance(
447+
self.widget, (TextInput, NumberInput, EmailInput, URLInput, DateInput, Select)):
447448
before = '<span class="{input_class}">{addon}</span>'.format(
448449
input_class=self.addon_before_class, addon=self.addon_before) if self.addon_before else ''
449450
after = '<span class="{input_class}">{addon}</span>'.format(

bootstrap3/templatetags/bootstrap3.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,8 @@ def bootstrap_formset_errors(*args, **kwargs):
286286
The formset that is being rendered
287287
288288
layout
289-
Context value that is available in the template ``bootstrap3/form_errors.html`` as ``layout``.
289+
Context value that is available in the template ``bootstrap3/form_errors.html``
290+
as ``layout``.
290291
291292
**Usage**::
292293
@@ -803,7 +804,8 @@ def bootstrap_pagination(page, **kwargs):
803804
:default: ``None``
804805
805806
size
806-
Controls the size of the pagination through CSS. Defaults to being normal sized.
807+
Controls the size of the pagination through CSS.
808+
Defaults to being normal sized.
807809
808810
One of the following:
809811

bootstrap3/tests.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from django import forms
77
from django.contrib.admin.widgets import AdminSplitDateTime
8+
from django.contrib.gis import forms as gisforms
89
from django.contrib.messages import constants as DEFAULT_MESSAGE_LEVELS
910
from django.forms.formsets import formset_factory
1011
from django.template import engines
@@ -58,6 +59,7 @@ class TestForm(forms.Form):
5859
label='Sender © unicode',
5960
help_text='E.g., "[email protected]"')
6061
secret = forms.CharField(initial=42, widget=forms.HiddenInput)
62+
weird = forms.CharField(help_text=u"strings are now utf-8 \u03BCnico\u0394é!")
6163
cc_myself = forms.BooleanField(
6264
required=False,
6365
help_text='cc stands for "carbon copy." You will get a copy in your mailbox.'
@@ -86,10 +88,15 @@ class TestForm(forms.Form):
8688
widget=forms.CheckboxSelectMultiple,
8789
help_text='Check as many as you like.',
8890
)
91+
number = forms.FloatField()
92+
url = forms.URLField()
8993
addon = forms.CharField(
9094
widget=forms.TextInput(attrs={'addon_before': 'before', 'addon_after': 'after'}),
9195
)
9296

97+
# TODO: Re-enable this after Django 1.11 #28105 is available
98+
# polygon = gisforms.PointField()
99+
93100
required_css_class = 'bootstrap3-req'
94101

95102
# Set this to allow tests to work properly in Django 1.10+
@@ -704,3 +711,44 @@ def test_button_with_icon(self):
704711
res.strip(),
705712
'<button class="btn btn-default" type="submit"><span class="glyphicon glyphicon-info-sign"></span> test</button>'
706713
)
714+
715+
716+
class ShowPlaceholderTest(TestCase):
717+
def test_placeholder_set_from_label(self):
718+
res = render_form_field('sender')
719+
self.assertIn('placeholder="Sender © unicode"', res)
720+
721+
722+
class ShowAddonsTest(TestCase):
723+
724+
def assertFieldHasAddons(self, field):
725+
"""Asserts that a given field has an after and before addon."""
726+
addon_before = "bf"
727+
addon_after = "af"
728+
729+
res = render_template_with_form(
730+
'{{% bootstrap_field form.{0} addon_before="{1}" addon_after="{2}" %}}'.format(
731+
field, addon_before, addon_after)
732+
)
733+
734+
self.assertIn('class="input-group"', res)
735+
self.assertIn('class="input-group-addon">{0}'.format(addon_before), res)
736+
self.assertIn('class="input-group-addon">{0}'.format(addon_after), res)
737+
738+
def test_show_addons_textinput(self):
739+
self.assertFieldHasAddons("subject")
740+
741+
def test_show_addons_select(self):
742+
self.assertFieldHasAddons("select1")
743+
744+
def test_show_addons_dateinput(self):
745+
self.assertFieldHasAddons("date")
746+
747+
def test_show_addons_email(self):
748+
self.assertFieldHasAddons("sender")
749+
750+
def test_show_addons_number(self):
751+
self.assertFieldHasAddons("number")
752+
753+
def test_show_addons_url(self):
754+
self.assertFieldHasAddons("url")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Django>=1.4
1+
Django>=1.8
22
Sphinx
33
sphinx_rtd_theme

testsettings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
'django.contrib.sessions',
1818
'django.contrib.messages',
1919
'django.contrib.staticfiles',
20+
'django.contrib.gis',
2021

2122
# We test this one
2223
'bootstrap3',
@@ -42,6 +43,8 @@
4243

4344
ROOT_URLCONF = None
4445

46+
STATIC_URL = '/static/'
47+
4548
BOOTSTRAP3 = {
4649
'theme_url': '//example.com/theme.css',
4750
'javascript_in_head': True,

tox.ini

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,27 @@
66
[tox]
77
minversion=1.8.0
88
envlist =
9-
py27-django18,
10-
py27-django19,
11-
py27-django110,
12-
py27-django111,
13-
14-
py33-django18,
15-
16-
py34-django18,
17-
py34-django19,
18-
py34-django110,
19-
py34-django111,
20-
21-
py35-django19,
22-
py35-django110,
23-
py35-django111,
24-
25-
py36-django110,
26-
py36-django111
9+
py27-django{18,19,110,111}
10+
py33-django{18}
11+
py34-django{18,19,110,111}
12+
py35-django{19,110,111}
13+
py36-django{110,111}
14+
docs
2715

2816
[testenv]
29-
commands = python manage.py test
17+
commands = coverage run --append --source='.' manage.py test -v1 --noinput
3018
deps =
3119
django18: Django>=1.8,<1.9
3220
django19: Django>=1.9,<1.10
3321
django110: Django>=1.10,<1.11
34-
django111: Django>=1.11b1,<2.0
22+
django111: Django>=1.11,<2.0
23+
coverage
24+
25+
[testenv:docs]
26+
changedir = docs
27+
deps =
28+
django>=1.8
29+
sphinx
30+
sphinx_rtd_theme
31+
commands = sphinx-build -b html -d _build/doctrees . _build/html
32+

0 commit comments

Comments
 (0)