Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
django_tables2/ | H | 05-Oct-2021 | - | 5,298 | 4,101 | |
django_tables2.egg-info/ | H | 03-May-2022 | - | 107 | 86 | |
example/ | H | 05-Oct-2021 | - | 36 | 35 | |
CHANGELOG.md | H A D | 05-Oct-2021 | 39.7 KiB | 593 | 475 | |
LICENSE | H A D | 24-May-2018 | 1.6 KiB | 37 | 29 | |
MANIFEST.in | H A D | 07-Oct-2019 | 327 | 11 | 10 | |
PKG-INFO | H A D | 05-Oct-2021 | 3.8 KiB | 107 | 86 | |
README.md | H A D | 18-Dec-2019 | 2.5 KiB | 71 | 53 | |
pyproject.toml | H A D | 27-Jun-2018 | 31 | 3 | 2 | |
setup.cfg | H A D | 05-Oct-2021 | 38 | 5 | 3 | |
setup.py | H A D | 05-Oct-2021 | 1.8 KiB | 48 | 42 |
README.md
1# django-tables2 - An app for creating HTML tables 2 3[![Latest PyPI version](https://badge.fury.io/py/django-tables2.svg)](https://pypi.python.org/pypi/django-tables2) 4[![Any color you like](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black) 5 6django-tables2 simplifies the task of turning sets of data into HTML tables. It 7has native support for pagination and sorting. It does for HTML tables what 8`django.forms` does for HTML forms. e.g. 9 10- Available on pypi as [django-tables2](https://pypi.python.org/pypi/django-tables2) 11- Tested against currently supported versions of Django 12 [and supported python 3 versions Django supports](https://docs.djangoproject.com/en/dev/faq/install/#what-python-version-can-i-use-with-django). 13- [Documentation on readthedocs.org](https://django-tables2.readthedocs.io/en/latest/) 14- [Bug tracker](http://github.com/jieter/django-tables2/issues) 15 16Features: 17 18- Any iterable can be a data-source, but special support for Django `QuerySets` is included. 19- The builtin UI does not rely on JavaScript. 20- Support for automatic table generation based on a Django model. 21- Supports custom column functionality via subclassing. 22- Pagination. 23- Column based table sorting. 24- Template tag to enable trivial rendering to HTML. 25- Generic view mixin. 26 27![An example table rendered using django-tables2](https://cdn.rawgit.com/jieter/django-tables2/master/docs/img/example.png) 28 29![An example table rendered using django-tables2 and bootstrap theme](https://cdn.rawgit.com/jieter/django-tables2/master/docs/img/bootstrap.png) 30 31![An example table rendered using django-tables2 and semantic-ui theme]( 32https://cdn.rawgit.com/jieter/django-tables2/master/docs/img/semantic.png) 33 34## Example 35 36Start by adding `django_tables2` to your `INSTALLED_APPS` setting like this: 37 38```python 39INSTALLED_APPS = ( 40 ..., 41 "django_tables2", 42) 43``` 44 45Creating a table for a model `Simple` is as simple as: 46 47```python 48import django_tables2 as tables 49 50class SimpleTable(tables.Table): 51 class Meta: 52 model = Simple 53``` 54This would then be used in a view: 55 56```python 57class TableView(tables.SingleTableView): 58 table_class = SimpleTable 59 queryset = Simple.objects.all() 60 template_name = "simple_list.html" 61``` 62And finally in the template: 63 64``` 65{% load django_tables2 %} 66{% render_table table %} 67``` 68 69This example shows one of the simplest cases, but django-tables2 can do a lot more! 70Check out the [documentation](https://django-tables2.readthedocs.io/en/latest/) for more details. 71