• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

django_tables2/H05-Oct-2021-5,2984,101

django_tables2.egg-info/H03-May-2022-10786

example/H05-Oct-2021-3635

CHANGELOG.mdH A D05-Oct-202139.7 KiB593475

LICENSEH A D24-May-20181.6 KiB3729

MANIFEST.inH A D07-Oct-2019327 1110

PKG-INFOH A D05-Oct-20213.8 KiB10786

README.mdH A D18-Dec-20192.5 KiB7153

pyproject.tomlH A D27-Jun-201831 32

setup.cfgH A D05-Oct-202138 53

setup.pyH A D05-Oct-20211.8 KiB4842

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