METADATA 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. Metadata-Version: 2.1
  2. Name: django-tables2
  3. Version: 2.4.1
  4. Summary: Table/data-grid framework for Django
  5. Home-page: https://github.com/jieter/django-tables2/
  6. Author: Bradley Ayers
  7. Author-email: bradley.ayers@gmail.com
  8. License: Simplified BSD
  9. Platform: UNKNOWN
  10. Classifier: Development Status :: 5 - Production/Stable
  11. Classifier: Environment :: Web Environment
  12. Classifier: Framework :: Django
  13. Classifier: Framework :: Django :: 2.2
  14. Classifier: Framework :: Django :: 3.1
  15. Classifier: Framework :: Django :: 3.2
  16. Classifier: Framework :: Django :: 4.0
  17. Classifier: Intended Audience :: Developers
  18. Classifier: License :: OSI Approved :: BSD License
  19. Classifier: Operating System :: OS Independent
  20. Classifier: Programming Language :: Python
  21. Classifier: Programming Language :: Python :: 3
  22. Classifier: Programming Language :: Python :: 3 :: Only
  23. Classifier: Programming Language :: Python :: 3.5
  24. Classifier: Programming Language :: Python :: 3.6
  25. Classifier: Programming Language :: Python :: 3.7
  26. Classifier: Programming Language :: Python :: 3.8
  27. Classifier: Programming Language :: Python :: 3.9
  28. Classifier: Programming Language :: Python :: 3.10
  29. Classifier: Topic :: Internet :: WWW/HTTP
  30. Classifier: Topic :: Software Development :: Libraries
  31. Description-Content-Type: text/markdown
  32. License-File: LICENSE
  33. Requires-Dist: Django (>=1.11)
  34. Provides-Extra: tablib
  35. Requires-Dist: tablib ; extra == 'tablib'
  36. # django-tables2 - An app for creating HTML tables
  37. [![Latest PyPI version](https://badge.fury.io/py/django-tables2.svg)](https://pypi.python.org/pypi/django-tables2)
  38. [![Any color you like](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
  39. django-tables2 simplifies the task of turning sets of data into HTML tables. It
  40. has native support for pagination and sorting. It does for HTML tables what
  41. `django.forms` does for HTML forms. e.g.
  42. - Available on pypi as [django-tables2](https://pypi.python.org/pypi/django-tables2)
  43. - Tested against currently supported versions of Django
  44. [and supported python 3 versions Django supports](https://docs.djangoproject.com/en/dev/faq/install/#what-python-version-can-i-use-with-django).
  45. - [Documentation on readthedocs.org](https://django-tables2.readthedocs.io/en/latest/)
  46. - [Bug tracker](http://github.com/jieter/django-tables2/issues)
  47. Features:
  48. - Any iterable can be a data-source, but special support for Django `QuerySets` is included.
  49. - The builtin UI does not rely on JavaScript.
  50. - Support for automatic table generation based on a Django model.
  51. - Supports custom column functionality via subclassing.
  52. - Pagination.
  53. - Column based table sorting.
  54. - Template tag to enable trivial rendering to HTML.
  55. - Generic view mixin.
  56. ![An example table rendered using django-tables2](https://cdn.rawgit.com/jieter/django-tables2/master/docs/img/example.png)
  57. ![An example table rendered using django-tables2 and bootstrap theme](https://cdn.rawgit.com/jieter/django-tables2/master/docs/img/bootstrap.png)
  58. ![An example table rendered using django-tables2 and semantic-ui theme](
  59. https://cdn.rawgit.com/jieter/django-tables2/master/docs/img/semantic.png)
  60. ## Example
  61. Start by adding `django_tables2` to your `INSTALLED_APPS` setting like this:
  62. ```python
  63. INSTALLED_APPS = (
  64. ...,
  65. "django_tables2",
  66. )
  67. ```
  68. Creating a table for a model `Simple` is as simple as:
  69. ```python
  70. import django_tables2 as tables
  71. class SimpleTable(tables.Table):
  72. class Meta:
  73. model = Simple
  74. ```
  75. This would then be used in a view:
  76. ```python
  77. class TableView(tables.SingleTableView):
  78. table_class = SimpleTable
  79. queryset = Simple.objects.all()
  80. template_name = "simple_list.html"
  81. ```
  82. And finally in the template:
  83. ```
  84. {% load django_tables2 %}
  85. {% render_table table %}
  86. ```
  87. This example shows one of the simplest cases, but django-tables2 can do a lot more!
  88. Check out the [documentation](https://django-tables2.readthedocs.io/en/latest/) for more details.