django-bootstrap3 23.2__tar.gz → 23.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. {django_bootstrap3-23.2 → django_bootstrap3-23.4}/.gitignore +3 -0
  2. {django_bootstrap3-23.2 → django_bootstrap3-23.4}/PKG-INFO +3 -4
  3. {django_bootstrap3-23.2 → django_bootstrap3-23.4}/README.md +1 -1
  4. {django_bootstrap3-23.2 → django_bootstrap3-23.4}/pyproject.toml +3 -8
  5. django_bootstrap3-23.4/src/bootstrap3/.DS_Store +0 -0
  6. django_bootstrap3-23.4/src/bootstrap3/__about__.py +1 -0
  7. {django_bootstrap3-23.2 → django_bootstrap3-23.4}/src/bootstrap3/renderers.py +17 -13
  8. django_bootstrap3-23.4/src/bootstrap3/templates/.DS_Store +0 -0
  9. {django_bootstrap3-23.2 → django_bootstrap3-23.4}/src/bootstrap3/utils.py +5 -0
  10. django_bootstrap3-23.2/src/bootstrap3/__about__.py +0 -1
  11. {django_bootstrap3-23.2 → django_bootstrap3-23.4}/AUTHORS +0 -0
  12. {django_bootstrap3-23.2 → django_bootstrap3-23.4}/LICENSE +0 -0
  13. {django_bootstrap3-23.2 → django_bootstrap3-23.4}/src/.DS_Store +0 -0
  14. {django_bootstrap3-23.2 → django_bootstrap3-23.4}/src/bootstrap3/__init__.py +0 -0
  15. {django_bootstrap3-23.2 → django_bootstrap3-23.4}/src/bootstrap3/bootstrap.py +0 -0
  16. {django_bootstrap3-23.2 → django_bootstrap3-23.4}/src/bootstrap3/components.py +0 -0
  17. {django_bootstrap3-23.2 → django_bootstrap3-23.4}/src/bootstrap3/exceptions.py +0 -0
  18. {django_bootstrap3-23.2 → django_bootstrap3-23.4}/src/bootstrap3/forms.py +0 -0
  19. {django_bootstrap3-23.2 → django_bootstrap3-23.4}/src/bootstrap3/models.py +0 -0
  20. {django_bootstrap3-23.2 → django_bootstrap3-23.4}/src/bootstrap3/templates/bootstrap3/bootstrap3.html +0 -0
  21. {django_bootstrap3-23.2 → django_bootstrap3-23.4}/src/bootstrap3/templates/bootstrap3/field_error.html +0 -0
  22. {django_bootstrap3-23.2 → django_bootstrap3-23.4}/src/bootstrap3/templates/bootstrap3/field_help_text.html +0 -0
  23. {django_bootstrap3-23.2 → django_bootstrap3-23.4}/src/bootstrap3/templates/bootstrap3/field_help_text_and_errors.html +0 -0
  24. {django_bootstrap3-23.2 → django_bootstrap3-23.4}/src/bootstrap3/templates/bootstrap3/form_errors.html +0 -0
  25. {django_bootstrap3-23.2 → django_bootstrap3-23.4}/src/bootstrap3/templates/bootstrap3/messages.html +0 -0
  26. {django_bootstrap3-23.2 → django_bootstrap3-23.4}/src/bootstrap3/templates/bootstrap3/pagination.html +0 -0
  27. {django_bootstrap3-23.2 → django_bootstrap3-23.4}/src/bootstrap3/templatetags/__init__.py +0 -0
  28. {django_bootstrap3-23.2 → django_bootstrap3-23.4}/src/bootstrap3/templatetags/bootstrap3.py +0 -0
  29. {django_bootstrap3-23.2 → django_bootstrap3-23.4}/src/bootstrap3/text.py +0 -0
@@ -63,3 +63,6 @@ local_settings.py
63
63
  # pyenv
64
64
  .python-version
65
65
  reports
66
+
67
+ # Example database
68
+ example/db.sqlite3
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-bootstrap3
3
- Version: 23.2
3
+ Version: 23.4
4
4
  Summary: Bootstrap 3 for Django
5
5
  Project-URL: Changelog, https://github.com/zostera/django-bootstrap3/blob/main/CHANGELOG.md
6
6
  Project-URL: Documentation, https://django-bootstrap3.readthedocs.io/
@@ -21,14 +21,13 @@ Classifier: Intended Audience :: Developers
21
21
  Classifier: License :: OSI Approved :: BSD License
22
22
  Classifier: Operating System :: OS Independent
23
23
  Classifier: Programming Language :: Python :: 3
24
- Classifier: Programming Language :: Python :: 3.7
25
24
  Classifier: Programming Language :: Python :: 3.8
26
25
  Classifier: Programming Language :: Python :: 3.9
27
26
  Classifier: Programming Language :: Python :: 3.10
28
27
  Classifier: Programming Language :: Python :: 3.11
29
28
  Classifier: Topic :: Software Development :: Libraries
30
29
  Classifier: Topic :: Utilities
31
- Requires-Python: >=3.7
30
+ Requires-Python: >=3.8
32
31
  Requires-Dist: beautifulsoup4>=4.8.0
33
32
  Requires-Dist: django>=3.2
34
33
  Description-Content-Type: text/markdown
@@ -40,7 +39,7 @@ Description-Content-Type: text/markdown
40
39
  [![Latest PyPI version](https://img.shields.io/pypi/v/django-bootstrap3.svg)](https://pypi.python.org/pypi/django-bootstrap3)
41
40
  [![Any color you like](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
42
41
 
43
- Bootstrap 3 integration for Django.
42
+ Bootstrap 3 for Django.
44
43
 
45
44
  ## Goal
46
45
 
@@ -5,7 +5,7 @@
5
5
  [![Latest PyPI version](https://img.shields.io/pypi/v/django-bootstrap3.svg)](https://pypi.python.org/pypi/django-bootstrap3)
6
6
  [![Any color you like](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
7
7
 
8
- Bootstrap 3 integration for Django.
8
+ Bootstrap 3 for Django.
9
9
 
10
10
  ## Goal
11
11
 
@@ -17,7 +17,6 @@ classifiers = [
17
17
  "License :: OSI Approved :: BSD License",
18
18
  "Operating System :: OS Independent",
19
19
  "Programming Language :: Python :: 3",
20
- "Programming Language :: Python :: 3.7",
21
20
  "Programming Language :: Python :: 3.8",
22
21
  "Programming Language :: Python :: 3.9",
23
22
  "Programming Language :: Python :: 3.10",
@@ -36,7 +35,7 @@ dynamic = [
36
35
  license = "BSD-3-Clause"
37
36
  name = "django-bootstrap3"
38
37
  readme = "README.md"
39
- requires-python = ">=3.7"
38
+ requires-python = ">=3.8"
40
39
 
41
40
  [project.urls]
42
41
  Changelog = "https://github.com/zostera/django-bootstrap3/blob/main/CHANGELOG.md"
@@ -74,10 +73,6 @@ cov-report = [
74
73
  test = "python manage.py test {args:tests}"
75
74
  test-cov = "coverage run manage.py test {args:tests}"
76
75
 
77
- [[tool.hatch.envs.all.matrix]]
78
- django = ["3.2"]
79
- python = ["3.7"]
80
-
81
76
  [[tool.hatch.envs.all.matrix]]
82
77
  django = ["3.2", "4.1", "4.2"]
83
78
  python = ["3.8", "3.9"]
@@ -149,7 +144,7 @@ style = [
149
144
 
150
145
  [tool.black]
151
146
  line-length = 120
152
- target_version = ["py37", "py38", "py39", "py310", "py311"]
147
+ target_version = ["py38", "py39", "py310", "py311"]
153
148
 
154
149
  [tool.ruff]
155
150
  fix = false
@@ -174,7 +169,7 @@ select = [
174
169
  "UP", # pyupgrade
175
170
  ]
176
171
  src = ["src"]
177
- target-version = "py37"
172
+ target-version = "py38"
178
173
  unfixable = [
179
174
  "F8", # names in flake8, such as defined but unused variables
180
175
  ]
@@ -0,0 +1 @@
1
+ __version__ = "23.4"
@@ -1,3 +1,5 @@
1
+ import re
2
+
1
3
  from django.forms import (
2
4
  BaseForm,
3
5
  BaseFormSet,
@@ -31,7 +33,7 @@ from .forms import (
31
33
  render_label,
32
34
  )
33
35
  from .text import text_value
34
- from .utils import add_css_class, render_template_file
36
+ from .utils import IS_PRE_DJANGO4, add_css_class, render_template_file
35
37
 
36
38
  try:
37
39
  # If Django is set up without a database, importing this widget gives RuntimeError
@@ -311,15 +313,17 @@ class FieldRenderer(BaseRenderer):
311
313
 
312
314
  def list_to_class(self, html, klass):
313
315
  classes = add_css_class(klass, self.get_size_class())
314
- mapping = [
315
- ("<ul", "<div"),
316
- ("</ul>", "</div>"),
317
- ("<li", f'<div class="{classes}"'),
318
- ("</li>", "</div>"),
319
- ]
320
- for k, v in mapping:
321
- html = html.replace(k, v)
322
- return html
316
+ if IS_PRE_DJANGO4:
317
+ return self._list_to_class_pre_django4(html, classes)
318
+ return re.sub("\s*<div>\s*<label", f' <div class="{classes}"><label', html)
319
+
320
+ def _list_to_class_pre_django4(self, html, classes):
321
+ return (
322
+ html.replace("<ul", "<div")
323
+ .replace("</ul>", "</div>")
324
+ .replace("<li", f'<div class="{classes}"')
325
+ .replace("</li>", "</div>")
326
+ )
323
327
 
324
328
  def put_inside_label(self, html):
325
329
  content = f"{html} {self.label}"
@@ -355,10 +359,10 @@ class FieldRenderer(BaseRenderer):
355
359
  return f'<div class="row bootstrap3-multi-input"><div class="col-xs-12">{html}</div></div>'
356
360
 
357
361
  def post_widget_render(self, html):
358
- if isinstance(self.widget, RadioSelect):
359
- html = self.list_to_class(html, "radio")
360
- elif isinstance(self.widget, CheckboxSelectMultiple):
362
+ if isinstance(self.widget, CheckboxSelectMultiple):
361
363
  html = self.list_to_class(html, "checkbox")
364
+ elif isinstance(self.widget, RadioSelect):
365
+ html = self.list_to_class(html, "radio")
362
366
  elif isinstance(self.widget, SelectDateWidget):
363
367
  html = self.fix_date_select_input(html)
364
368
  elif isinstance(self.widget, ClearableFileInput):
@@ -1,6 +1,7 @@
1
1
  import re
2
2
  from urllib.parse import parse_qs, urlencode, urlparse, urlunparse
3
3
 
4
+ from django import get_version
4
5
  from django.forms.utils import flatatt
5
6
  from django.template import Variable, VariableDoesNotExist
6
7
  from django.template.base import FilterExpression, TemplateSyntaxError, kwarg_re
@@ -13,6 +14,10 @@ from bootstrap3.exceptions import BootstrapError
13
14
 
14
15
  from .text import text_value
15
16
 
17
+ # TODO: Remove after support for Django 3.2 ends
18
+ IS_PRE_DJANGO4 = get_version() < "4"
19
+
20
+
16
21
  # RegEx for quoted string
17
22
  QUOTED_STRING = re.compile(r'^["\'](?P<noquotes>.+)["\']$')
18
23
 
@@ -1 +0,0 @@
1
- __version__ = "23.2"