Update upstream source from tag 'upstream/2.4.0'
Update to upstream version '2.4.0'
with Debian dir 75d317cc24feafb1f2b6f4aeb85204a419d4c614
Carsten Schoenert
2 years ago
30 | 30 |
runs-on: ubuntu-latest
|
31 | 31 |
strategy:
|
32 | 32 |
matrix:
|
33 | |
python-version: [3.5, 3.6, 3.7, 3.8]
|
34 | |
django-version: [2.2, 3.0, 3.1]
|
|
33 |
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
|
|
34 |
django-version: [2.2, 3.1, 3.2]
|
35 | 35 |
exclude:
|
36 | 36 |
- python-version: 3.5
|
37 | |
django-version: 3.0
|
|
37 |
django-version: 3.1
|
38 | 38 |
- python-version: 3.5
|
39 | |
django-version: 3.1
|
|
39 |
django-version: 3.2
|
40 | 40 |
- python-version: 3.8
|
41 | 41 |
django-version: 2.2
|
|
42 |
- python-version: 3.9
|
|
43 |
django-version: 2.2
|
|
44 |
|
42 | 45 |
|
43 | 46 |
steps:
|
44 | 47 |
- name: Set up Python ${{ matrix.python-version }}
|
|
46 | 49 |
with:
|
47 | 50 |
python-version: ${{ matrix.python-version }}
|
48 | 51 |
- uses: actions/checkout@v2
|
49 | |
- uses: actions/cache@v2.1.3
|
|
52 |
- uses: actions/cache@v2.1.5
|
50 | 53 |
with:
|
51 | 54 |
path: ~/.cache/pip
|
52 | 55 |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
0 | 0 |
# Change log
|
|
1 |
|
|
2 |
# 2.4.0 (2021-05-15)
|
|
3 |
- Add support for django 3.2 and python 3.9, drop support for django 3.0
|
|
4 |
- Add Django 3.0 and 3.1 trove classifiers [#803](https://github.com/jieter/django-tables2/pull/803) by [@Asday](https://github.com/Asday)
|
|
5 |
- Strip leading and trailing whitespace from TemplateColumn.value() [#794](https://github.com/jieter/django-tables2/pull/794) by [@jeremystretch](https://github.com/jeremystretch)
|
|
6 |
- Providing link for django-bootstrap3 [#793](https://github.com/jieter/django-tables2/pull/793) by [@TareqMonwer](https://github.com/TareqMonwer)
|
|
7 |
- Fix for crash on windows while deleting temp file [#788](https://github.com/jieter/django-tables2/pull/788)
|
1 | 8 |
|
2 | 9 |
# 2.3.4 (2021-01-10)
|
3 | 10 |
- Removed deprecation warnings with django==3.1 regarding `JSONField` [#785](https://github.com/jieter/django-tables2/pull/785)
|
19 | 19 |
from .utils import A
|
20 | 20 |
from .views import MultiTableMixin, SingleTableMixin, SingleTableView
|
21 | 21 |
|
22 | |
__version__ = "2.3.4"
|
|
22 |
__version__ = "2.4.0"
|
23 | 23 |
|
24 | 24 |
__all__ = (
|
25 | 25 |
"Table",
|
70 | 70 |
"""
|
71 | 71 |
The value returned from a call to `value()` on a `TemplateColumn` is
|
72 | 72 |
the rendered template with `django.utils.html.strip_tags` applied.
|
|
73 |
Leading and trailing whitespace is stripped.
|
73 | 74 |
"""
|
74 | 75 |
html = super().value(**kwargs)
|
75 | |
return strip_tags(html) if isinstance(html, str) else html
|
|
76 |
return strip_tags(html).strip() if isinstance(html, str) else html
|
82 | 82 |
attrs = {"class": "paleblue"}
|
83 | 83 |
|
84 | 84 |
If you supply a a callable as a value in the dict, it will be called
|
85 | |
at table instantiation an the returned value will be used:
|
|
85 |
at table instantiation and the returned value will be used:
|
86 | 86 |
|
87 | 87 |
Consider this example where each table gets an unique ``"id"``
|
88 | 88 |
attribute::
|
22 | 22 |
|
23 | 23 |
|
24 | 24 |
The ``FilterSet`` is added to the template context in a ``filter`` variable by
|
25 | |
default. A basic template rendering the filter (using django-bootstrap3) and
|
|
25 |
default. A basic template rendering the filter (using django-bootstrap3)[https://pypi.org/project/django-bootstrap3/] and
|
26 | 26 |
table looks like this::
|
27 | 27 |
|
28 | 28 |
{% load render_table from django_tables2 %}
|
0 | 0 |
-e ..
|
1 | 1 |
django-bootstrap3==11.0.0
|
2 | 2 |
django-bootstrap4==0.0.8
|
3 | |
django-debug-toolbar==1.11
|
|
3 |
django-debug-toolbar==1.11.1
|
4 | 4 |
django-filter==2.2
|
5 | 5 |
tablib==0.13.0
|
24 | 24 |
"Development Status :: 5 - Production/Stable",
|
25 | 25 |
"Environment :: Web Environment",
|
26 | 26 |
"Framework :: Django",
|
27 | |
"Framework :: Django :: 2.1",
|
28 | 27 |
"Framework :: Django :: 2.2",
|
|
28 |
"Framework :: Django :: 3.1",
|
|
29 |
"Framework :: Django :: 3.2",
|
29 | 30 |
"Intended Audience :: Developers",
|
30 | 31 |
"License :: OSI Approved :: BSD License",
|
31 | 32 |
"Operating System :: OS Independent",
|
|
36 | 37 |
"Programming Language :: Python :: 3.6",
|
37 | 38 |
"Programming Language :: Python :: 3.7",
|
38 | 39 |
"Programming Language :: Python :: 3.8",
|
|
40 |
"Programming Language :: Python :: 3.9",
|
39 | 41 |
"Topic :: Internet :: WWW/HTTP",
|
40 | 42 |
"Topic :: Software Development :: Libraries",
|
41 | 43 |
],
|
106 | 106 |
table = Table([{"track": "Space Oddity"}])
|
107 | 107 |
|
108 | 108 |
self.assertEqual(list(table.as_values()), [["Track"], ["Space Oddity"]])
|
|
109 |
|
|
110 |
def test_should_strip_whitespace_for_value(self):
|
|
111 |
class Table(tables.Table):
|
|
112 |
track = tables.TemplateColumn(" {{ value }} ")
|
|
113 |
|
|
114 |
table = Table([{"track": "Space Oddity"}])
|
|
115 |
|
|
116 |
self.assertEqual(list(table.as_values()), [["Track"], ["Space Oddity"]])
|
535 | 535 |
self.fail("__bool__ should not be evaluated!")
|
536 | 536 |
|
537 | 537 |
def test_attrs_falsy_object(self):
|
538 | |
"""Computed attrs in BoundColumn should be passed the column value, even if its __bool__ returns False. """
|
|
538 |
"""Computed attrs in BoundColumn should be passed the column value, even if its __bool__ returns False."""
|
539 | 539 |
|
540 | 540 |
class Table(tables.Table):
|
541 | 541 |
c_element = tables.Column()
|
0 | 0 |
import json
|
|
1 |
import os
|
1 | 2 |
from datetime import date, datetime, time
|
2 | 3 |
from tempfile import NamedTemporaryFile
|
3 | 4 |
from unittest import skipIf
|
|
217 | 218 |
response = View.as_view()(build_request("/?_export=xlsx"))
|
218 | 219 |
self.assertEqual(response.status_code, 200)
|
219 | 220 |
|
220 | |
with NamedTemporaryFile(suffix=".xlsx") as tmp:
|
|
221 |
tmp = NamedTemporaryFile(suffix=".xlsx", delete=False)
|
|
222 |
try:
|
221 | 223 |
tmp.write(response.content)
|
222 | 224 |
tmp.seek(0)
|
223 | 225 |
wb = load_workbook(tmp.name)
|
224 | 226 |
self.assertIn(title, wb.sheetnames)
|
|
227 |
finally:
|
|
228 |
tmp.close()
|
|
229 |
os.unlink(tmp.name)
|
225 | 230 |
|
226 | 231 |
|
227 | 232 |
class OccupationTable(tables.Table):
|
1 | 1 |
args_are_paths = false
|
2 | 2 |
envlist =
|
3 | 3 |
py35-{2.2},
|
4 | |
py36-{2.2,3.0,3.1,master},
|
5 | |
py37-{2.2,3.0,3.1,master},
|
6 | |
py38-{3.0,3.1,master},
|
|
4 |
py36-{2.2,3.1,3.2,master},
|
|
5 |
py37-{2.2,3.1,3.2,master},
|
|
6 |
py38-{3.1,3.2,master},
|
7 | 7 |
docs,
|
8 | 8 |
flake8,
|
9 | 9 |
isort,
|
|
15 | 15 |
py36: python3.6
|
16 | 16 |
py37: python3.7
|
17 | 17 |
py38: python3.8
|
|
18 |
py39: python3.9
|
18 | 19 |
usedevelop = true
|
19 | 20 |
pip_pre = true
|
20 | 21 |
setenv =
|
|
24 | 25 |
coverage run --source=django_tables2 manage.py test {posargs}
|
25 | 26 |
deps =
|
26 | 27 |
2.2: Django==2.2.*
|
27 | |
3.0: Django==3.0.*
|
28 | 28 |
3.1: Django==3.1.*
|
|
29 |
3.2: Django==3.2.*
|
29 | 30 |
master: https://github.com/django/django/archive/master.tar.gz
|
30 | 31 |
coverage
|
31 | 32 |
-r{toxinidir}/requirements/common.pip
|