Codebase list django-tables / 18e9348
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
12 changed file(s) with 44 addition(s) and 17 deletion(s). Raw diff Collapse all Expand all
3030 runs-on: ubuntu-latest
3131 strategy:
3232 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]
3535 exclude:
3636 - python-version: 3.5
37 django-version: 3.0
37 django-version: 3.1
3838 - python-version: 3.5
39 django-version: 3.1
39 django-version: 3.2
4040 - python-version: 3.8
4141 django-version: 2.2
42 - python-version: 3.9
43 django-version: 2.2
44
4245
4346 steps:
4447 - name: Set up Python ${{ matrix.python-version }}
4649 with:
4750 python-version: ${{ matrix.python-version }}
4851 - uses: actions/checkout@v2
49 - uses: actions/cache@v2.1.3
52 - uses: actions/cache@v2.1.5
5053 with:
5154 path: ~/.cache/pip
5255 key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
00 # 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)
18
29 # 2.3.4 (2021-01-10)
310 - Removed deprecation warnings with django==3.1 regarding `JSONField` [#785](https://github.com/jieter/django-tables2/pull/785)
1919 from .utils import A
2020 from .views import MultiTableMixin, SingleTableMixin, SingleTableView
2121
22 __version__ = "2.3.4"
22 __version__ = "2.4.0"
2323
2424 __all__ = (
2525 "Table",
7070 """
7171 The value returned from a call to `value()` on a `TemplateColumn` is
7272 the rendered template with `django.utils.html.strip_tags` applied.
73 Leading and trailing whitespace is stripped.
7374 """
7475 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
8282 attrs = {"class": "paleblue"}
8383
8484 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:
8686
8787 Consider this example where each table gets an unique ``"id"``
8888 attribute::
2222
2323
2424 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
2626 table looks like this::
2727
2828 {% load render_table from django_tables2 %}
00 -e ..
11 django-bootstrap3==11.0.0
22 django-bootstrap4==0.0.8
3 django-debug-toolbar==1.11
3 django-debug-toolbar==1.11.1
44 django-filter==2.2
55 tablib==0.13.0
2424 "Development Status :: 5 - Production/Stable",
2525 "Environment :: Web Environment",
2626 "Framework :: Django",
27 "Framework :: Django :: 2.1",
2827 "Framework :: Django :: 2.2",
28 "Framework :: Django :: 3.1",
29 "Framework :: Django :: 3.2",
2930 "Intended Audience :: Developers",
3031 "License :: OSI Approved :: BSD License",
3132 "Operating System :: OS Independent",
3637 "Programming Language :: Python :: 3.6",
3738 "Programming Language :: Python :: 3.7",
3839 "Programming Language :: Python :: 3.8",
40 "Programming Language :: Python :: 3.9",
3941 "Topic :: Internet :: WWW/HTTP",
4042 "Topic :: Software Development :: Libraries",
4143 ],
106106 table = Table([{"track": "Space Oddity"}])
107107
108108 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"]])
535535 self.fail("__bool__ should not be evaluated!")
536536
537537 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."""
539539
540540 class Table(tables.Table):
541541 c_element = tables.Column()
00 import json
1 import os
12 from datetime import date, datetime, time
23 from tempfile import NamedTemporaryFile
34 from unittest import skipIf
217218 response = View.as_view()(build_request("/?_export=xlsx"))
218219 self.assertEqual(response.status_code, 200)
219220
220 with NamedTemporaryFile(suffix=".xlsx") as tmp:
221 tmp = NamedTemporaryFile(suffix=".xlsx", delete=False)
222 try:
221223 tmp.write(response.content)
222224 tmp.seek(0)
223225 wb = load_workbook(tmp.name)
224226 self.assertIn(title, wb.sheetnames)
227 finally:
228 tmp.close()
229 os.unlink(tmp.name)
225230
226231
227232 class OccupationTable(tables.Table):
11 args_are_paths = false
22 envlist =
33 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},
77 docs,
88 flake8,
99 isort,
1515 py36: python3.6
1616 py37: python3.7
1717 py38: python3.8
18 py39: python3.9
1819 usedevelop = true
1920 pip_pre = true
2021 setenv =
2425 coverage run --source=django_tables2 manage.py test {posargs}
2526 deps =
2627 2.2: Django==2.2.*
27 3.0: Django==3.0.*
2828 3.1: Django==3.1.*
29 3.2: Django==3.2.*
2930 master: https://github.com/django/django/archive/master.tar.gz
3031 coverage
3132 -r{toxinidir}/requirements/common.pip