[Python-modules-commits] [django-tables] 01/04: New upstream version 1.9.0
Brian May
bam at moszumanska.debian.org
Sun Jun 25 08:49:38 UTC 2017
This is an automated email from the git hooks/post-receive script.
bam pushed a commit to branch debian/master
in repository django-tables.
commit eb10626308a39f02dc6a771a1899f0b86bd1cb95
Author: Brian May <bam at debian.org>
Date: Sun Jun 25 18:34:48 2017 +1000
New upstream version 1.9.0
---
.gitignore | 3 +
.isort.cfg | 5 +
.travis.yml | 35 +-
CHANGELOG.md | 502 +++++++++---------
CONTRIBUTING.md | 6 +-
README.rst | 27 +-
django_tables2/__init__.py | 22 +-
django_tables2/columns/__init__.py | 8 +
django_tables2/columns/base.py | 483 ++++++++++-------
django_tables2/columns/booleancolumn.py | 52 +-
django_tables2/columns/checkboxcolumn.py | 35 +-
django_tables2/columns/datecolumn.py | 19 +-
django_tables2/columns/datetimecolumn.py | 19 +-
django_tables2/columns/emailcolumn.py | 27 +-
django_tables2/columns/filecolumn.py | 50 +-
django_tables2/columns/jsoncolumn.py | 61 +++
django_tables2/columns/linkcolumn.py | 98 ++--
django_tables2/columns/templatecolumn.py | 26 +-
django_tables2/columns/timecolumn.py | 17 +-
django_tables2/columns/urlcolumn.py | 19 +-
django_tables2/config.py | 39 +-
django_tables2/data.py | 219 ++++++++
django_tables2/export/TODO.md | 10 +
django_tables2/export/__init__.py | 5 +
django_tables2/export/export.py | 91 ++++
django_tables2/export/views.py | 28 +
django_tables2/locale/nb/LC_MESSAGES/django.mo | Bin 0 -> 679 bytes
django_tables2/locale/nb/LC_MESSAGES/django.po | 47 ++
django_tables2/models.py | 2 -
django_tables2/rows.py | 247 ++++++---
django_tables2/tables.py | 577 ++++++++++-----------
.../django_tables2/bootstrap-responsive.html | 15 +
.../templates/django_tables2/bootstrap.html | 89 ++--
.../templates/django_tables2/semantic.html | 82 +++
django_tables2/templates/django_tables2/table.html | 22 +-
django_tables2/templatetags/django_tables2.py | 90 ++--
django_tables2/utils.py | 325 +++++++-----
django_tables2/views.py | 206 +++++---
docs/conf.py | 34 +-
docs/img/bootstrap.png | Bin 0 -> 53274 bytes
docs/img/example.png | Bin 0 -> 18698 bytes
docs/img/semantic.png | Bin 0 -> 45388 bytes
docs/index.rst | 67 ++-
docs/pages/accessors.rst | 29 --
docs/pages/api-reference.rst | 295 ++++++-----
docs/pages/builtin-columns.rst | 3 +-
docs/pages/column-attributes.rst | 40 +-
docs/pages/column-headers-and-footers.rst | 153 ++++++
docs/pages/column-headers.rst | 38 --
.../{custom-rendering.rst => custom-data.rst} | 89 ++--
docs/pages/custom-rendering.rst | 112 +---
docs/pages/export.rst | 53 ++
docs/pages/faq.rst | 125 +++++
docs/pages/filtering.rst | 19 +
docs/pages/generic-mixins.rst | 57 +-
docs/pages/installation.rst | 11 +
docs/pages/internal.rst | 56 ++
docs/pages/localization-control.rst | 14 +-
docs/pages/order-by-accessors.rst | 47 --
docs/pages/ordering.rst | 121 +++++
docs/pages/pagination.rst | 8 +-
docs/pages/performance.rst | 12 +
docs/pages/pinned-rows.rst | 68 +++
docs/pages/query-string-fields.rst | 11 +-
docs/pages/reference.rst | 8 +
docs/pages/table-data.rst | 59 ++-
docs/pages/tables-for-models.rst | 33 --
docs/pages/template-filters.rst | 19 -
docs/pages/template-tags.rst | 2 +-
docs/pages/tutorial.rst | 40 +-
docs/pages/upgrade-changelog.rst | 12 +
docs/pages/upgrading-from-v1.rst | 2 +-
docs/requirements.txt | 5 +
example/README.md | 16 +
example/README.rst | 6 -
example/app/admin.py | 3 +
example/app/filters.py | 12 +
example/app/fixtures/initial_data.json | 11 -
example/app/migrations/0001_initial.py | 41 --
example/app/migrations/0002_person_country.py | 21 -
example/app/models.py | 17 +-
example/app/tables.py | 22 +-
example/app/tests.py | 17 -
example/app/views.py | 118 ++++-
example/requirements.pip | 4 +-
example/settings.py | 8 +-
example/templates/base.html | 6 +-
example/templates/bootstrap_template.html | 16 +-
example/templates/class_based.html | 2 +-
example/templates/index.html | 35 ++
example/templates/multiTable.html | 25 +
example/templates/semantic_template.html | 16 +
example/templates/tutorial.html | 4 +-
example/urls.py | 15 +-
requirements/common.pip | 2 +-
requirements/django-dev.pip | 3 +-
setup.py | 3 +-
tests/app/locale/ua/LC_MESSAGES/django.mo | Bin 0 -> 291 bytes
tests/app/locale/ua/LC_MESSAGES/django.po | 11 +
tests/app/models.py | 58 ++-
tests/app/templates/multiple.html | 6 +
tests/app/templates/test_template_column.html | 2 +-
tests/app/views.py | 5 +-
tests/columns/test_booleancolumn.py | 49 +-
tests/columns/test_datecolumn.py | 21 +-
tests/columns/test_datetimecolumn.py | 24 +-
tests/columns/test_emailcolumn.py | 8 +
tests/columns/test_filecolumn.py | 23 +-
tests/columns/test_general.py | 118 ++++-
tests/columns/test_jsoncolumn.py | 56 ++
tests/columns/test_linkcolumn.py | 78 ++-
tests/columns/test_templatecolumn.py | 41 +-
tests/columns/test_timecolumn.py | 12 +-
tests/columns/test_urlcolumn.py | 9 +
.../app/migrations => tests/export}/__init__.py | 0
tests/export/test_export.py | 135 +++++
tests/test_config.py | 54 +-
tests/test_core.py | 368 ++++++-------
tests/test_data.py | 38 ++
tests/test_dynamically_add_show_hide_columns.py | 131 +++++
tests/test_faq.py | 71 +++
tests/test_footer.py | 68 +++
tests/test_models.py | 182 +++++--
tests/test_ordering.py | 313 +++++++++++
tests/test_pinned_rows.py | 183 +++++++
tests/test_rows.py | 111 ++++
tests/test_tabledata.py | 108 ++++
tests/test_templates.py | 72 ++-
tests/test_templatetags.py | 86 +--
tests/test_utils.py | 25 +-
tests/test_views.py | 246 ++++++++-
tests/utils.py | 50 +-
tox.ini | 31 +-
133 files changed, 5978 insertions(+), 2488 deletions(-)
diff --git a/.gitignore b/.gitignore
index 9aa2ebb..265d0a8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,10 @@
/dist/
/build/
/docs/_build/
+/docs/pages/CHANGELOG.md
/example/database.sqlite
/example/.env
/report.pylint
.cache/
+.python-version
+.idea
diff --git a/.isort.cfg b/.isort.cfg
new file mode 100644
index 0000000..abec776
--- /dev/null
+++ b/.isort.cfg
@@ -0,0 +1,5 @@
+[settings]
+line_length = 120
+known_third_party=django,django_filter,pytest,fudge,lxml
+known_first_party=django_tables2
+skip=migrations/*.py
diff --git a/.travis.yml b/.travis.yml
index 635c462..b7f72d5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,34 +1,15 @@
language: python
-# django 1.9 is only supported on py27 and py35
-# django 1.8 is the first realease supporting py35
-matrix:
- include:
- - python: 2.7
- env: TOXENV=py27-1.8
- - python: 2.7
- env: TOXENV=py27-1.9
- - python: 3.3
- env: TOXENV=py33-1.8
- - python: 3.4
- env: TOXENV=py34-1.8
- - python: 3.4
- env: TOXENV=py34-1.9
- - python: 3.5
- env: TOXENV=py35-1.8
- - python: 3.5
- env: TOXENV=py35-1.9
- - python: 2.7
- env: TOXENV=py27-master
- - python: 3.5
- env: TOXENV=py35-master
+python:
+ - "2.7"
+ - "3.3"
+ - "3.4"
+ - "3.5"
+ - "3.6"
- allow_failures:
- - env: TOXENV=py27-master
- - env: TOXENV=py35-master
install:
- - pip install tox
- - pip install python-coveralls
+ - pip install tox-travis python-coveralls
+
script:
- tox
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7188759..338c286 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,104 @@
# Change log
+## master (unreleased)
+
+## 1.9.0 (2017-06-22)
+Allow computable attrs for `<td>`-tags from `Table.attrs` ([#457](https://github.com/bradleyayers/django-tables2/pull/457), fixes [#451](https://github.com/bradleyayers/django-tables2/issues/451))
+
+## 1.8.0 (2017-06-17)
+ - Feature: Added an `ExportMixin` to export table data in various export formats (CSV, XLS, etc.) using [tablib](http://docs.python-tablib.org/en/latest/).
+ - Defer expanding `Meta.sequence` to `Table.__init__`, to make sequence work in combination with `extra_columns` (fixes [#450](https://github.com/bradleyayers/django-tables2/issues/450))
+ - Fixed a crash when `MultiTableMixin.get_tables()` returned an empty array ([#454](https://github.com/bradleyayers/django-tables2/pull/455) by [@pypetey](https://github.com/pypetey)
+
+## 1.7.1 (2017-06-02)
+ - Call before_render when rendering with the render_table template tag (fixes [#447](https://github.com/bradleyayers/django-tables2/issues/447))
+
+## 1.7.0 (2017-06-01)
+ - Make `title()` lazy ([#443](https://github.com/bradleyayers/django-tables2/pull/443) by [@ygwain](https://github.com/ygwain), fixes [#438](https://github.com/bradleyayers/django-tables2/issues/438))
+ - Fix `__all__` by populating them with the names of the items to export instead of the items themself.
+ - Allow adding extra columns to an instance using the `extra_columns` argument. Fixes [#403](https://github.com/bradleyayers/django-tables2/issues/403), [#70](https://github.com/bradleyayers/django-tables2/issues/70)
+ - Added a hook `before_render` to allow last-minute changes to the table before rendering.
+ - Added `BoundColumns.show()` and `BoundColumns.hide()` to show/hide columns on an instance of a `Table`.
+ - Use `<listlike>.verbose_name`/`.verbose_name_plural` if it exists to name the items in the list. (fixes [#166](https://github.com/bradleyayers/django-tables2/issues/166))
+
+## 1.6.1 (2017-05-08)
+ - Add missing pagination to the responsive bootstrap template ([#440](https://github.com/bradleyayers/django-tables2/pull/440) by [@tobiasmcnulty](https://github.com/tobiasmcnulty))
+
+## 1.6.0 (2017-05-01)
+ - Add new template `bootstrap-responsive.html` to generate a responsive bootstrap table. (Fixes [#436](https://github.com/bradleyayers/django-tables2/issues/436))
+
+## 1.5.0 (2017-04-18)
+_Full disclosure: as of april 1st, 2017, I am an employee of [Zostera](http://zostera.nl/), as such I will continue to maintain and improve django-tables2._
+ - Made `TableBase.as_values()` an interator ([#432](https://github.com/bradleyayers/django-tables2/pull/432) by [@pziarsolo](https://github.com/pziarsolo))
+ - Added `JSONField` for data in JSON format.
+ - Added `__all__` in `django_tables2/__init__.py` and `django_tables2/columns/__init__.py`
+ - Added a setting `DJANGO_TABLES2_TEMPLATE` to allow project-wide overriding of the template used to render tables (fixes [#434](https://github.com/bradleyayers/django-tables2/issues/434)).
+
+## 1.4.2 (2017-03-06)
+ - Feature: Pinned rows ([#411](https://github.com/bradleyayers/django-tables2/pull/411) by [@djk2](https://github.com/djk2), fixes [#406](https://github.com/bradleyayers/django-tables2/issues/406))
+ - Fix an issue where `ValueError` was raised while using a view with a `get_queryset()` method defined. (fix with [#423](https://github.com/bradleyayers/django-tables2/pull/423) by [@desecho](https://github.com/desecho))
+
+## 1.4.1 (2017-02-27)
+ - Fix urls to screenshots in on pypi description (fixes [ #398](https://github.com/bradleyayers/django-tables2/issues/398))
+ - Prevent superfluous spaces when a callable `row_attrs['class']` returns an empty string ([#417](https://github.com/bradleyayers/django-tables2/pull/417 by [@Superman8218](https://github.com/Superman8218)), fixes [#416](https://github.com/bradleyayers/django-tables2/issues/416))
+
+
+## 1.4.0 (2017-02-27)
+ - Return `None` from `Table.as_values()` for missing values. [#419](https://github.com/bradleyayers/django-tables2/pull/419)
+ - Fix ordering by custom fields, and refactor `TableData` [#424](https://github.com/bradleyayers/django-tables2/pull/424), fixes [#413](https://github.com/bradleyayers/django-tables2/issues/413)
+ - Revert removing `TableData.__iter__()` (removed in [this commit](https://github.com/bradleyayers/django-tables2/commit/8fe9826429e6945a9258bc181fcbd711b282dba9)), fixes [#427](https://github.com/bradleyayers/django-tables2/issues/427), [#361](https://github.com/bradleyayers/django-tables2/issues/361) and [#421](https://github.com/bradleyayers/django-tables2/issues/421).
+
+## 1.3.0 (2017-01-20)
+ - Implement method `Table.as_values()` to get it's raw values. [#394](https://github.com/bradleyayers/django-tables2/pull/394) by [@intiocean](https://github.com/intiocean)
+ - Fix some compatibility issues with django 2.0 [#408](https://github.com/bradleyayers/django-tables2/pull/409) by [djk2](https://github.com/djk2)
+
+## 1.2.9 (2016-12-21)
+ - Documentation for `None`-column attributes [#401](https://github.com/bradleyayers/django-tables2/pull/401) by [@dyve](https://github.com/dyve)
+
+## 1.2.8 (2016-12-21)
+ - `None`-column attributes on child class overwrite column attributes of parent class
+ [#400](https://github.com/bradleyayers/django-tables2/pull/400) by [@dyve](https://github.com/dyve)
+
+## 1.2.7 (2016-12-12)
+- Apply `title` to a column's `verbose_name` when it is derived from a model, fixes [#249](https://github.com/bradleyayers/django-tables2/issues/249). ([#382](https://github.com/bradleyayers/django-tables2/pull/382) by [@shawnnapora](https://github.com/shawnnapora))
+- Update documentation after deprecation of `STATIC_URL` in django ([#384](https://github.com/bradleyayers/django-tables2/pull/384), by [@velaia](https://github.com/velaia))
+- Cleanup of the templates, making the output more equal ([#381](https://github.com/bradleyayers/django-tables2/pull/381) by [@ralgozino](https://github.com/ralgozino))
+- Use new location for `urlresolvers` in Django and add backwards compatible import ([#388](https://github.com/bradleyayers/django-tables2/pull/388) by [@felixxm](https://github.com/felixxm))
+- Fix a bug where using `sequence` and then `exclude` in a child table would result in a `KeyError`
+- Some documentation fixes and cleanups.
+
+## 1.2.6 (2016-09-06)
+- Added `get_table_kwargs()` method to `SingleTableMixin` to allow passing custom keyword arguments to the `Table` constructor. ([#366](https://github.com/bradleyayers/django-tables2/pull/366) by [@fritz-k](https://github.com/fritz-k))
+- Allow the children of `TableBase` render in the `{% render_table %}` template tag. ([#377](https://github.com/bradleyayers/django-tables2/pull/377) by [@shawnnapora](https://github.com/shawnnapora))
+- Refactor `BoundColumn` attributes to allow override of CSS class names, fixes [#349](https://github.com/bradleyayers/django-tables2/issues/349) ([#370](https://github.com/bradleyayers/django-tables2/pull/370) by [@graup](https://github.com/graup)). Current behaviour should be intact, we will change the default in the future so it will **not** add the column name to the list of CSS classes.
+
+## 1.2.5 (2016-07-30)
+- Fixed an issue preventing the rest of the row being rendered if a `BooleanColumn` was in the table for a model without custom choices defined on the model field. ([#360](https://github.com/bradleyayers/django-tables2/issues/360))
+
+## 1.2.4 (2016-07-28)
+- Added Norwegian Locale ([#356](https://github.com/bradleyayers/django-tables2/issues/356) by [@fanzypantz](https://github.com/fanzypantz))
+- Restore default pagination for `SingleTableMixin`, fixes [#354](https://github.com/bradleyayers/django-tables2/issues/354) ([#395](https://github.com/bradleyayers/django-tables2/pull/359) by [@graup](https://github.com/graup))
+
+## 1.2.3 (2016-07-05)
+ - Accept `text` parameter in `FileColumn`, analogous to `LinkColumn` ([#343](https://github.com/bradleyayers/django-tables2/pull/343) by [@graup](https://github.com/graup))
+ - Fix TemplateColumn RemovedInDjango110Warning fixes [#346](https://github.com/bradleyayers/django-tables2/issues/346).
+ - Use field name in RelatedColumnLink ([#350](https://github.com/bradleyayers/django-tables2/pull/350), fixes [#347](https://github.com/bradleyayers/django-tables2/issues/347))
+
+## v1.2.2 (2016-06-04)
+- Allow use of custom class names for ordered columns through `attrs`. (
+[#329](https://github.com/bradleyayers/django-tables2/pull/329) by [@theTarkus](https://github.com/theTarkus))
+- Column ordering queryset passthrough ([#330](https://github.com/bradleyayers/django-tables2/pull/330) by [@theTarkus](https://github.com/theTarkus))
+- Cleanup/restructuring of [documentation](http://django-tables2.readthedocs.io/), ([#325](https://github.com/bradleyayers/django-tables2/pull/325))
+- Fixed an issue where explicitly defined column options where not preserved over inheritance ([#339](https://github.com/bradleyayers/django-tables2/pull/339), [issue #337](https://github.com/bradleyayers/django-tables2/issues/337))
+- Fixed an issue where `exclude` in combination with `sequence` raised a KeyError ([#341](https://github.com/bradleyayers/django-tables2/pull/341), [issue #205](https://github.com/bradleyayers/django-tables2/issues/205))
+
+## v1.2.1 (2016-05-09)
+- table footers (#323)
+- Non-field based `LinkColumn` only renders default value if lookup fails. (#322)
+- Accept `text` parameter in `BaseLinkColumn`-based columns. (#322)
+- Pass the table instance into SingleTableMixin's get_table_pagination (#320 by [@georgema1982](https://github.com/georgema1982), fixes #319)
+- Check if the view has `paginate_by` before before trying to access it. (fixes #326)
+
## v1.2.0 (2016-05-02)
- Allow custom attributes for rows (fixes #47)
@@ -72,270 +171,197 @@
## v1.0.4 (2015-05-09)
- Fix bug in retrieving `field.verbose_name` under Django 1.8.
-v1.0.3
-------
-
+## v1.0.3
- Remove setup.cfg as PyPI doesn't actually support it, instead it's a distutils2 thing that's been discontinued.
-v1.0.2
-------
-
+## v1.0.2
- Add setup.cfg to declare README.md for PyPI.
-v1.0.1
-------
-
+## v1.0.1
- Convert README to markdown so it's formatted nicely on PyPI.
-v1.0.0
-------
-
+## v1.0.0
- Travis CI builds pass.
- Added Python 3.4 support.
- Added Django 1.7 and Django 1.8 support.
-- Dropped Python 2.6 and 3.2 support.
-- Drop Django 1.2 support
- Convert tests to using py.test.
-v0.16.0
--------
-
+## v0.16.0
- Django 1.8 fixes
-- `BoundColumn.verbose_name` now titlises only if no verbose_name was given.
- `verbose_name` is used verbatim.
+- `BoundColumn.verbose_name` now titlises only if no verbose_name was given. `verbose_name` is used verbatim.
- Add max_length attribute to person CharField
- Add Swedish translation
- Update docs presentation on readthedocs
-v0.15.0
--------
-
+## v0.15.0
- Add UK, Russian, Spanish, Portuguese, and Polish translations
- Add support for computed table `attrs`.
-v0.14.0
--------
-
-- `querystring` and `seturlparam` template tags now require the request to
- be in the context (backwards incompatible) -- #127
+## v0.14.0
+- `querystring` and `seturlparam` template tags now require the request to be in the context (backwards incompatible) -- #127
- Add Travis CI support
- Add support for Django 1.5
- Add L10N control for columns #120 (ignored in < Django 1.3)
- Drop Python 2.6.4 support in favour of Python 3.2 support
-- Non-queryset data ordering is different between Python 3 and 2. When
- comparing different types, their truth values are now compared before falling
- back to string representations of their type.
-
-v0.13.0
--------
+- Non-queryset data ordering is different between Python 3 and 2. When comparing different types, their truth values are now compared before falling back to string representations of their type.
+## v0.13.0
- Add FileColumn.
-v0.12.1
--------
-
+## v0.12.1
- When resolving an accessor, *all* exceptions are smothered into `None`.
-v0.12.0
--------
-
-- Improve performance by removing unnecessary queries
-- Simplified pagination:
-
- - `Table.page` is an instance attribute (no longer `@property`)
- - Exceptions raised by paginators (e.g. `EmptyPage`) are no longer
- smothered by `Table.page`
- - Pagination exceptions are raised by `Table.paginate`
- - `RequestConfig` can handles pagination errors silently, can be disabled
- by including `silent=False` in the `paginate` argument value
-
-- Add `DateTimeColumn` and `DateColumn` to handle formatting `datetime`
- and timezones.
-- Add `BooleanColumn` to handle bool values
-- `render_table` can now build and render a table for a queryset, rather than
- needing to be passed a table instance
-- Table columns created automatically from a model now use specialised columns
-- `Column.render` is now skipped if the value is considered *empty*, the
- default value is used instead. Empty values are specified via
- `Column.empty_values`, by default is `(None, '')` (backward incompatible)
-- Default values can now be specified on table instances or `Table.Meta`
-- Accessor's now honor `alters_data` during resolving. Fixes issue that would
- delete all your data when a column had an accessor of `delete`
-- Add `default` and `value` to context of `TemplateColumn`
-- Add cardinality indication to the pagination area of a table
-- `Attrs` is deprecated, use `dict` instead
-
-v0.11.0
--------
-
-- Add `URLColumn` to render URLs in a data source into hyperlinks
-- Add `EmailColumn` to render email addresses into hyperlinks
-- `TemplateColumn` can now Django's template loaders to render from a file
-
-v0.10.4
--------
-
-- Fix more bugs on Python 2.6.4, all tests now pass.
-
-v0.10.3
--------
-
-- Fix issues for Python 2.6.4 -- thanks Steve Sapovits & brianmay
-- Reduce Django 1.3 dependency to Table.as_html -- thanks brianmay
-
-v0.10.2
--------
-
-- Fix MANIFEST.in to include example templates, thanks TWAC.
-- Upgrade django-attest to fix problem with tests on Django 1.3.1
-
-v0.10.1
--------
-
-- Fixed support for Django 1.4's paginator (thanks koledennix)
-- Some juggling of internal implementation. `TableData` now supports slicing
- and returns new `TableData` instances. `BoundRows` now takes a single
- argument `data` (a `TableData` instance).
-- Add support for `get_pagination` on `SingleTableMixin`.
-- `SingleTableMixin` and `SingleTableView` are now importable directly from
- `django_tables2`.
-
-v0.10.0
--------
-
-- Renamed `BoundColumn.order_by` to `order_by_alias` and never returns `None`
- (**Backwards incompatible**). Templates are affected if they use something
- like:
-
- {% querystring table.prefixed_order_by_field=column.order_by.opposite|default:column.name %}
-
- Which should be rewritten as:
-
- {% querystring table.prefixed_order_by_field=column.order_by_alias.next %}
-
-- Added `next` shortcut to `OrderBy` returned from `BoundColumn.order_by_alias`
-- Added `OrderByTuple.get()`
-- Deprecated `BoundColumn.sortable`, `Column.sortable`, `Table.sortable`,
- `sortable` CSS class, `BoundColumns.itersortable`, `BoundColumns.sortable`; use `orderable` instead of
- `sortable`.
-- Added `BoundColumn.is_ordered`
-- Introduced concept of an `order by alias`, see glossary in the docs for details.
-
-v0.9.6
-------
-
-- Fix bug that caused an ordered column's th to have no HTML attributes.
-
-v0.9.5
-------
-
-- Updated example project to add colspan on footer cell so table border renders
- correctly in Webkit.
-- Fix regression that caused 'sortable' class on <th>.
-- Table.__init__ no longer *always* calls .order_by() on querysets, fixes #55.
- This does introduce a slight backwards incompatibility. `Table.order_by` now
- has the possibility of returning `None`, previously it would *always* return
- an `OrderByTuple`.
-- DeclarativeColumnsMetaclass.__new__ now uses super()
-- Testing now requires pylint and Attest >=0.5.3
-
-v0.9.4
-------
-
-- Fix regression that caused column verbose_name values that were marked as
- safe to be escaped. Now any verbose_name values that are instances of
- SafeData are used unmodified.
-
-v0.9.3
-------
-
-- Fix regression in `SingleTableMixin`.
-- Remove stray `print` statement.
-
-v0.9.2
-------
-
-- `SingleTableView` now uses `RequestConfig`. This fixes issues with
- `order_by_field`, `page_field`, and `per_page_field` not being honored.
-- Add `Table.Meta.per_page` and change `Table.paginate` to use it as default.
-- Add `title` template filter. It differs from Django's built-in `title` filter
- because it operates on an individual word basis and leaves words containing
- capitals untouched. **Warning**: use `{% load ... from ... %}` to avoid
- inadvertantly replacing Django's builtin `title` template filter.
-- `BoundColumn.verbose_name` no longer does `capfirst`, titlising is now the
- responsbility of `Column.header`.
-- `BoundColumn.__unicode__` now uses `BoundColumn.header` rather than
- `BoundColumn.verbose_name`.
-
-v0.9.1
-------
-
-- Fix version in setup.py (doh)
-
-v0.9.0
-------
-
-- Add support for column attributes (see Attrs)
-- Add BoundRows.items() to yield (bound_column, cell) pairs
-- Tried to make docs more concise. Much stronger promotion of using
- RequestConfig and {% querystring %}
-
-v0.8.4
-------
-
-- Removed random 'print' statements.
-- Tweaked 'paleblue' theme css to be more flexible
- - removed `whitespace: no-wrap`
- - header background image to support more than 2 rows of text
-
-v0.8.3
-------
-
-- Fixed stupid import mistake. Tests didn't pick it up due to them ignoring
- `ImportError`.
-
-v0.8.2
-------
-
-- `SingleTableView` now inherits from `ListView` which enables automatic
- `foo_list.html` template name resolution (thanks dramon for reporting)
-- `render_table` template tag no suppresses exceptions when `DEBUG=True`
-
-v0.8.1
-------
-
-- Fixed bug in render_table when giving it a template (issue #41)
-
-v0.8.0
-------
-
-- Added translation support in the default template via `{% trans %}`
-- Removed `basic_table.html`, `Table.as_html()` now renders `table.html` but
- will clobber the querystring of the current request. Use the `render_table`
- template tag instead
-- `render_table` now supports an optional second argument -- the template to
- use when rendering the table
-- `Table` now supports declaring which template to use when rendering to HTML
-- Django >=1.3 is now required
-- Added support for using django-haystack's `SearchQuerySet` as a data source
-- The default template `table.html` now includes block tags to make it easy to
- extend to change small pieces
-- Fixed table template parsing problems being hidden due to a subsequent
- exception being raised
-- Http404 exceptions are no longer raised during a call to `Table.paginate()`,
- instead it now occurs when `Table.page` is accessed
-- Fixed bug where a table couldn't be rendered more than once if it was
- paginated
-- Accessing `Table.page` now returns a new page every time, rather than reusing
- a single object
-
-v0.7.8
-------
-
-- Tables now support using both `sequence` and `exclude` (issue #32).
-- `Sequence` class moved to `django_tables2/utils.py`.
-- Table instances now support modification to the `exclude` property.
-- Removed `BoundColumns._spawn_columns`.
-- `Table.data`, `Table.rows`, and `Table.columns` are now attributes
- rather than properties.
+## v0.12.0
+ - Improve performance by removing unnecessary queries
+ - Simplified pagination:
+ - `Table.page` is an instance attribute (no longer `@property`)
+ - Exceptions raised by paginators (e.g. `EmptyPage`) are no longer
+ smothered by `Table.page`
+ - Pagination exceptions are raised by `Table.paginate`
+ - `RequestConfig` can handles pagination errors silently, can be disabled
+ by including `silent=False` in the `paginate` argument value
+ - Add `DateTimeColumn` and `DateColumn` to handle formatting `datetime`
+ and timezones.
+ - Add `BooleanColumn` to handle bool values
+ - `render_table` can now build and render a table for a queryset, rather than
+ needing to be passed a table instance
+ - Table columns created automatically from a model now use specialised columns
+ - `Column.render` is now skipped if the value is considered *empty*, the
+ default value is used instead. Empty values are specified via
+ `Column.empty_values`, by default is `(None, '')` (backward incompatible)
+ - Default values can now be specified on table instances or `Table.Meta`
+ - Accessor's now honor `alters_data` during resolving. Fixes issue that would
+ delete all your data when a column had an accessor of `delete`
+ - Add `default` and `value` to context of `TemplateColumn`
+ - Add cardinality indication to the pagination area of a table
+ - `Attrs` is deprecated, use `dict` instead
+
+## v0.11.0
+ - Add `URLColumn` to render URLs in a data source into hyperlinks
+ - Add `EmailColumn` to render email addresses into hyperlinks
+ - `TemplateColumn` can now Django's template loaders to render from a file
+
+## v0.10.4
+ - Fix more bugs on Python 2.6.4, all tests now pass.
+
+## v0.10.3
+ - Fix issues for Python 2.6.4 -- thanks Steve Sapovits & brianmay
+ - Reduce Django 1.3 dependency to Table.as_html -- thanks brianmay
+
+## v0.10.2
+ - Fix MANIFEST.in to include example templates, thanks TWAC.
+ - Upgrade django-attest to fix problem with tests on Django 1.3.1
+
+## v0.10.1
+ - Fixed support for Django 1.4's paginator (thanks koledennix)
+ - Some juggling of internal implementation.
+ `TableData` now supports slicing and returns new `TableData` instances.
+ `BoundRows` now takes a single argument `data` (a `TableData` instance).
+ - Add support for `get_pagination` on `SingleTableMixin`.
+ - `SingleTableMixin` and `SingleTableView` are now importable directly from `django_tables2`.
+
+## v0.10.0
+ - Renamed `BoundColumn.order_by` to `order_by_alias` and never returns `None`
+ (**Backwards incompatible**). Templates are affected if they use something like:
+
+ {% querystring table.prefixed_order_by_field=column.order_by.opposite|default:column.name %}
+
+ Which should be rewritten as:
+
+ {% querystring table.prefixed_order_by_field=column.order_by_alias.next %}
+
+ - Added `next` shortcut to `OrderBy` returned from `BoundColumn.order_by_alias`
+ - Added `OrderByTuple.get()`
+ - Deprecated `BoundColumn.sortable`, `Column.sortable`, `Table.sortable`,
+ `sortable` CSS class, `BoundColumns.itersortable`, `BoundColumns.sortable`; use `orderable` instead of `sortable`.
+ - Added `BoundColumn.is_ordered`
+ - Introduced concept of an `order by alias`, see glossary in the docs for details.
+
+## v0.9.6
+ - Fix bug that caused an ordered column's th to have no HTML attributes.
+
+## v0.9.5
+ - Updated example project to add colspan on footer cell so table border renders correctly in Webkit.
+ - Fix regression that caused 'sortable' class on <th>.
+ - Table.__init__ no longer *always* calls .order_by() on querysets, fixes #55.
+ This does introduce a slight backwards incompatibility. `Table.order_by` now has the possibility of returning `None`, previously it would *always* return an `OrderByTuple`.
+ - DeclarativeColumnsMetaclass.__new__ now uses super()
+ - Testing now requires pylint and Attest >=0.5.3
+
+## v0.9.4
+ - Fix regression that caused column verbose_name values that were marked as
+ safe to be escaped. Now any verbose_name values that are instances of
+ SafeData are used unmodified.
+
+## v0.9.3
+ - Fix regression in `SingleTableMixin`.
+ - Remove stray `print` statement.
+
+## v0.9.2
+ - `SingleTableView` now uses `RequestConfig`. This fixes issues with
+ `order_by_field`, `page_field`, and `per_page_field` not being honored.
+ - Add `Table.Meta.per_page` and change `Table.paginate` to use it as default.
+ - Add `title` template filter. It differs from Django's built-in `title` filter
+ because it operates on an individual word basis and leaves words containing
+ capitals untouched. **Warning**: use `{% load ... from ... %}` to avoid
+ inadvertantly replacing Django's builtin `title` template filter.
+ - `BoundColumn.verbose_name` no longer does `capfirst`, titlising is now the
+ responsbility of `Column.header`.
+ - `BoundColumn.__unicode__` now uses `BoundColumn.header` rather than
+ `BoundColumn.verbose_name`.
+
+## v0.9.1
+ - Fix version in setup.py (doh)
+
+## v0.9.0
+ - Add support for column attributes (see Attrs)
+ - Add BoundRows.items() to yield (bound_column, cell) pairs
+ - Tried to make docs more concise. Much stronger promotion of using
+ RequestConfig and {% querystring %}
+
+## v0.8.4
+ - Removed random 'print' statements.
+ - Tweaked 'paleblue' theme css to be more flexible:
+ - removed `whitespace: no-wrap`
+ - header background image to support more than 2 rows of text
+
+## v0.8.3
+ - Fixed stupid import mistake. Tests didn't pick it up due to them ignoring `ImportError`.
+
+## v0.8.2
+ - `SingleTableView` now inherits from `ListView` which enables automatic
+ `foo_list.html` template name resolution (thanks dramon for reporting)
+ - `render_table` template tag no suppresses exceptions when `DEBUG=True`
+
+## v0.8.1
+ - Fixed bug in render_table when giving it a template (issue #41)
+
+## v0.8.0
+ - Added translation support in the default template via `{% trans %}`
+ - Removed `basic_table.html`, `Table.as_html()` now renders `table.html` but
+ will clobber the querystring of the current request. Use the `render_table`
+ template tag instead
+ - `render_table` now supports an optional second argument -- the template to
+ use when rendering the table
+ - `Table` now supports declaring which template to use when rendering to HTML
+ - Django >=1.3 is now required
+ - Added support for using django-haystack's `SearchQuerySet` as a data source
+ - The default template `table.html` now includes block tags to make it easy to
+ extend to change small pieces
+ - Fixed table template parsing problems being hidden due to a subsequent
+ exception being raised
+ - Http404 exceptions are no longer raised during a call to `Table.paginate()`,
+ instead it now occurs when `Table.page` is accessed
+ - Fixed bug where a table couldn't be rendered more than once if it was
+ paginated
+ - Accessing `Table.page` now returns a new page every time, rather than reusing
+ a single object
+
+## v0.7.8
+ - Tables now support using both `sequence` and `exclude` (issue #32).
+ - `Sequence` class moved to `django_tables2/utils.py`.
+ - Table instances now support modification to the `exclude` property.
+ - Removed `BoundColumns._spawn_columns`.
+ - `Table.data`, `Table.rows`, and `Table.columns` are now attributes
+ rather than properties.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index d8f22b1..4a37fb1 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -4,7 +4,7 @@ You are welcome to contribute to the development of `django-tables2` in various
- Discover and [report bugs](https://github.com/bradleyayers/django-tables2/issues/new).
Make sure to include a minimal example to show your problem.
-- Propose features or fix bugs by [opening a Pull Request](https://github.com/bradleyayers/django-tables2/compare)
+- Propose features, add tests or fix bugs by [opening a Pull Request](https://github.com/bradleyayers/django-tables2/compare)
- Fix documenation or translations
When contributing code or making bug fixes, we need to have unit tests to verify the expected behaviour.
@@ -40,5 +40,5 @@ Publishing a release
1. Bump the version in `django-tables2/__init__.py`.
2. Update CHANGELOG.md`.
-3. Create a tag git tag -a v1.0.6 -m 'tagging v1.0.6'`
-4. Run `python setup.py sdist upload --sign --identity=<your gpg identity>`.
+3. Create a tag `./setup.py tag` or `git tag -a v1.0.6 -m 'tagging v1.0.6'`
+4. Run `./setup.py publish` or `python setup.py sdist upload --sign --identity=<your gpg identity>`.
diff --git a/README.rst b/README.rst
index e0d64dd..f0d5026 100644
--- a/README.rst
+++ b/README.rst
@@ -5,7 +5,7 @@ django-tables2 - An app for creating HTML tables
:target: https://pypi.python.org/pypi/django-tables2
:alt: Latest PyPI version
-.. image:: https://travis-ci.org/bradleyayers/django-tables2.svg
+.. image:: https://travis-ci.org/bradleyayers/django-tables2.svg?branch=master
:target: https://travis-ci.org/bradleyayers/django-tables2
:alt: Travis CI
@@ -13,10 +13,14 @@ django-tables2 simplifies the task of turning sets of data into HTML tables. It
has native support for pagination and sorting. It does for HTML tables what
`django.forms` does for HTML forms. e.g.
-.. image:: http://dl.dropbox.com/u/33499139/django-tables2/example.png
- :alt: An example table rendered using django-tables2
+- `Available on pypi <https://pypi.python.org/pypi/django-tables2>`_
+- Tested against currently supported versions of Django
+ `and the python versions Django supports <https://docs.djangoproject.com/en/dev/faq/install/#what-python-version-can-i-use-with-django>`_
+ (see `Travis CI <https://travis-ci.org/bradleyayers/django-tables2>`_)
+- `Documentation on readthedocs.org <https://django-tables2.readthedocs.io/en/latest/>`_
+- `Bug tracker <http://github.com/bradleyayers/django-tables2/issues>`_
-Its features include:
+Features:
- Any iterable can be a data-source, but special support for Django querysets is included.
- The builtin UI does not rely on JavaScript.
@@ -27,9 +31,14 @@ Its features include:
- Template tag to enable trivial rendering to HTML.
- Generic view mixin.
-- `Available on pypi <https://pypi.python.org/pypi/django-tables2>`_
-- `Tested with python 2.7, 3.3, 3.4, 3.5 and Django 1.8, 1.9 <https://travis-ci.org/bradleyayers/django-tables2>`_
-- `Documentation on readthedocs.org <http://django-tables2.readthedocs.org/en/latest/>`_
+.. image:: https://cdn.rawgit.com/bradleyayers/django-tables2/1044316e/docs/img/example.png
+ :alt: An example table rendered using django-tables2
+
+.. image:: https://cdn.rawgit.com/bradleyayers/django-tables2/1044316e/docs/img/bootstrap.png
+ :alt: An example table rendered using django-tables2 and bootstrap theme
+
+.. image:: https://cdn.rawgit.com/bradleyayers/django-tables2/1044316e/docs/img/semantic.png
+ :alt: An example table rendered using django-tables2 and semantic-ui theme
Example
-------
@@ -69,5 +78,5 @@ And finally in the template:
{% load django_tables2 %}
{% render_table table %}
-This example shows one of the simplest cases, but django-tables2 can do a lot more!
-Check out the _documentation: http://django-tables2.readthedocs.org/en/latest/ for more details.
+This example shows one of the simplest cases, but django-tables2 can do a lot more!
+Check out the `documentation <https://django-tables2.readthedocs.io/en/latest/>`_ for more details.
diff --git a/django_tables2/__init__.py b/django_tables2/__init__.py
index 88962c7..b62443c 100644
--- a/django_tables2/__init__.py
+++ b/django_tables2/__init__.py
@@ -1,11 +1,23 @@
# coding: utf-8
-from .tables import Table
+from .tables import Table, TableBase
from .columns import (BooleanColumn, Column, CheckBoxColumn, DateColumn,
- DateTimeColumn, EmailColumn, FileColumn, LinkColumn,
- RelatedLinkColumn, TemplateColumn, TimeColumn, URLColumn)
+ DateTimeColumn, EmailColumn, FileColumn, JSONColumn,
+ LinkColumn, RelatedLinkColumn, TemplateColumn,
+ TimeColumn, URLColumn)
from .config import RequestConfig
from .utils import A
-from .views import SingleTableMixin, SingleTableView
+from .views import SingleTableMixin, SingleTableView, MultiTableMixin
-__version__ = '1.2.0'
+__version__ = '1.9.0'
+
+__all__ = (
+ 'Table', 'TableBase',
+ 'BooleanColumn', 'Column', 'CheckBoxColumn', 'DateColumn', 'DateTimeColumn',
+ 'EmailColumn', 'FileColumn', 'JSONColumn', 'LinkColumn', 'RelatedLinkColumn',
+ 'TemplateColumn', 'TimeColumn', 'URLColumn',
+
+ 'RequestConfig',
+ 'A',
+ 'SingleTableMixin', 'SingleTableView', 'MultiTableMixin'
+)
diff --git a/django_tables2/columns/__init__.py b/django_tables2/columns/__init__.py
index 4abd7a5..a08d968 100644
--- a/django_tables2/columns/__init__.py
+++ b/django_tables2/columns/__init__.py
@@ -5,7 +5,15 @@ from .datecolumn import DateColumn
from .datetimecolumn import DateTimeColumn
from .emailcolumn import EmailColumn
from .filecolumn import FileColumn
+from .jsoncolumn import JSONColumn
from .linkcolumn import LinkColumn, RelatedLinkColumn
from .templatecolumn import TemplateColumn
from .urlcolumn import URLColumn
from .timecolumn import TimeColumn
+
+__all__ = (
+ 'library', 'BoundColumn', 'BoundColumns', 'Column',
+ 'BooleanColumn', 'CheckBoxColumn', 'DateColumn', 'DateTimeColumn',
+ 'EmailColumn', 'FileColumn', 'JSONColumn', 'LinkColumn',
+ 'RelatedLinkColumn', 'TemplateColumn', 'URLColumn', 'TimeColumn'
+)
diff --git a/django_tables2/columns/base.py b/django_tables2/columns/base.py
index eaed533..b09aee2 100644
--- a/django_tables2/columns/base.py
+++ b/django_tables2/columns/base.py
@@ -4,16 +4,18 @@ from __future__ import absolute_import, unicode_literals
from collections import OrderedDict
from itertools import islice
+from django.db import models
from django.utils import six
+from django.utils.safestring import SafeData
from django_tables2.templatetags.django_tables2 import title
-from django_tables2.utils import Accessor, AttributeDict, OrderBy, OrderByTuple
+from django_tables2.utils import Accessor, AttributeDict, OrderBy, OrderByTuple, call_with_appropriate, computed_values
class Library(object):
- """
+ '''
A collection of columns.
- """
+ '''
def __init__(self):
self.columns = []
@@ -22,11 +24,12 @@ class Library(object):
return column
def column_for_field(self, field):
- """
+ '''
Return a column object suitable for model field.
- :returns: column object of `None`
- """
+ Returns:
+ `.Column` object or `None`
+ '''
# iterate in reverse order as columns are registered in order
# of least to most specialised (i.e. Column is registered
# first). This also allows user-registered columns to be
@@ -48,102 +51,59 @@ library = Library()
@library.register
class Column(object):
- """
+ '''
Represents a single column of a table.
- `.Column` objects control the way a column (including the cells that
- fall within it) are rendered.
-
-
- .. attribute:: attrs
-
- HTML attributes for elements that make up the column.
-
- :type: `dict`
-
- This API is extended by subclasses to allow arbitrary HTML attributes
- to be added to the output.
-
- By default `.Column` supports:
-
- - *th* -- ``table/thead/th`` elements
- - *td* -- ``table/tbody/tr/td`` elements
- - *cell* -- fallback if *th* or *td* isn't defined
-
-
- .. attribute:: accessor
-
- An accessor that describes how to extract values for this column from
- the :term:`table data`.
-
- :type: string or `~.Accessor`
-
-
- .. attribute:: default
-
- The default value for the column. This can be a value or a callable
- object [1]_. If an object in the data provides `None` for a column, the
- default will be used instead.
-
- The default value may affect ordering, depending on the type of data
- the table is using. The only case where ordering is not affected is
- when a `.QuerySet` is used as the table data (since sorting is
- performed by the database).
-
- .. [1] The provided callable object must not expect to receive any
- arguments.
-
-
- .. attribute:: order_by
-
- Allows one or more accessors to be used for ordering rather than
- *accessor*.
-
- :type: `unicode`, `tuple`, `~.Accessor`
-
-
- .. attribute:: orderable
-
- If `False`, this column will not be allowed to influence row
- ordering/sorting.
-
- :type: `bool`
-
-
- .. attribute:: verbose_name
... 11356 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/django-tables.git
More information about the Python-modules-commits
mailing list