{"id":13937298,"url":"https://github.com/shymonk/django-datatable","last_synced_at":"2025-07-19T23:31:25.736Z","repository":{"id":11150178,"uuid":"13519007","full_name":"shymonk/django-datatable","owner":"shymonk","description":"django-datatable is a customizable table application of django based on jquery datatable.","archived":false,"fork":false,"pushed_at":"2024-01-03T00:18:58.000Z","size":622,"stargazers_count":169,"open_issues_count":37,"forks_count":55,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-11-14T15:49:13.199Z","etag":null,"topics":["datatable","python"],"latest_commit_sha":null,"homepage":"https://github.com/shymonk/django-datatable","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shymonk.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-10-12T08:56:15.000Z","updated_at":"2024-06-26T08:11:23.000Z","dependencies_parsed_at":"2024-05-02T23:13:47.161Z","dependency_job_id":null,"html_url":"https://github.com/shymonk/django-datatable","commit_stats":{"total_commits":566,"total_committers":14,"mean_commits":40.42857142857143,"dds":"0.49116607773851595","last_synced_commit":"f20a6ed2ce31aa7488ff85b4b0e80fe1ad94ec44"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shymonk%2Fdjango-datatable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shymonk%2Fdjango-datatable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shymonk%2Fdjango-datatable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shymonk%2Fdjango-datatable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shymonk","download_url":"https://codeload.github.com/shymonk/django-datatable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226693903,"owners_count":17667757,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["datatable","python"],"created_at":"2024-08-07T23:03:28.637Z","updated_at":"2024-11-27T05:31:04.269Z","avatar_url":"https://github.com/shymonk.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"django-datatable\n================\n\n|Build Status| |PyPI|\n\n.. figure:: https://www.shymonk.com/django-datatable/static/django_datatable_example.png\n   :alt: preview\n\n`online demo \u003chttps://www.shymonk.com/django-datatable/datasource/model/\u003e`__\n\nOverview\n--------\n\ndjango-datatable is a simple Django app to organize data in tabular\nform based on `datatable \u003chttp://datatables.net\u003e`__ and\n`bootstrap \u003chttp://getbootstrap.com/\u003e`__.\n\nIt is worth mentioning that the design of this project makes reference\nto `django-table2 \u003chttps://github.com/bradleyayers/django-tables2\u003e`__\nand is mainly for the purpose of learning. I really appreciate anyone\nmaking a pull-request to improve it.\n\nRequirements\n------------\n\n-  Python 2.x\n\n-  jQuery 1.6+\n\n-  Django 1.5+\n\n-  Bootstrap 3.0\n\nQuick start\n-----------\n\n-  Setup Django-datatable application in Python environment:\n\n   ::\n\n       $ pip install django-datatable\n\n-  Define a simple model named Person:\n\n   ::\n\n       # example/app/models.py\n       class Person(models.Model):\n           name = models.CharField(max_length=100)\n\n-  Add \"table\" to your INSTALLED\\_APPS setting like this:\n\n   ::\n\n       INSTALLED_APPS = (\n           ...,\n           'table',\n       )\n\n-  Add some data so you have something to display in the table. Now\n   define a PersonTable class without any options in the table file.\n\n   ::\n\n       # example/app/tables.py\n       from models import Person\n       from table import Table\n       from table.columns import Column\n\n       class PersonTable(Table):\n           id = Column(field='id')\n           name = Column(field='name')\n           class Meta:\n               model = Person\n\nAnd pass a table instance to the view.\n\n::\n\n        # example/app/views.py\n        from django.shortcuts import render\n        from app.tables import PersonTable\n\n        def people(request):\n            people = PersonTable()\n            return render(request, \"index.html\", {'people': people})\n\n-  Finally, implement the template:\n\n   ::\n\n       {# example/templates/index.html}\n       {% load static %}\n       {% load table_tags %}\n\n       \u003clink href=\"{% static 'table/css/bootstrap.min.css' %}\" rel=\"stylesheet\"\u003e\n       \u003cscript src=\"{% static 'table/js/jquery.min.js' %}\"\u003e\u003c/script\u003e\n       \u003cscript src=\"{% static 'table/js/bootstrap.min.js' %}\"\u003e\u003c/script\u003e\n\n       \u003c!DOCTYPE html\u003e\n       \u003chtml\u003e\n           \u003chead\u003e\n               \u003cmeta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" /\u003e\n               \u003ctitle\u003eperson\u003c/title\u003e\n           \u003c/head\u003e\n           \u003cbody\u003e\n               \u003cdiv class=\"container\" style=\"margin-top: 10px\"\u003e\n                   \u003ch1\u003epeople\u003c/h1\u003e\n                   \u003cbr /\u003e\n                   {% render_table people %}\n               \u003c/div\u003e\n           \u003c/body\u003e\n       \u003c/html\u003e\n\nTag\n---\n\nRender the whole table by simple tag ``{% render_table %}``, pass\n``Table`` instance as single argument.\n\n::\n\n    {% render_table table %}\n\nDataSource\n----------\n\nModel\n`````\n\nUses a django MTV model as table data source, and queries all data in\ndatabase by default. See **model** in table options for details.\n\nQuerySet\n````````\n\nSimiliar to **Model**, but pass queryset when you initialize the table\ninstance instead of defining model option. Basically, it is used to\nfilter or sort data you want to display in table.\n\n::\n\n    Models:\n\n        # models.py\n        class Person(models.Model):\n            name = models.CharField(max_length=100)\n\n    Tables:\n\n        # tables.py\n        from models import Person\n        from table import Table\n            from table.columns import Column\n\n        class PersonTable(Table):\n            id = Column(field='id')\n            name = Column(field='name')\n\n    Views:\n\n        # views.py\n        from django.shortcuts import render\n        from models import Person\n        from app.tables import PersonTable\n\n        def people(request):\n            people = PersonTable(Person.objects.all())\n            return render(request, \"index.html\", {'people': people})\n\nDict-List\n`````````\n\nUse a list of dictionaries as table data source. Fields declared in\ncolumns correspond to the dictionary keys.\n\n::\n\n    Tables:\n\n        # tables.py\n        from table import Table\n        from table.columns import Column\n\n        class PersonTable(Table):\n            id = Column(field='id')\n            name = Column(field='name')\n\n    Views:\n\n        # views.py\n        from django.shortcuts import render\n        from app.tables import PersonTable\n\n        def people(request):\n            data = [{'id': 1, 'name': 'John'}, {'id': 2, 'name': 'Tom'}]\n            people = PersonTable(data)\n            return render(request, \"index.html\", {'people': people})\n\nBuilt-in Ajax\n`````````````\n\nFor large amounts of data, loading them on front-end entirely is\nimpossible. So, django-table provides a simle option 'ajax' to load data\nfrom the server-side asynchronously.\n\nNote that once toggling ``ajax``, the ``model`` option is necessary.\nDjango-table will do paging/searching/sorting based on\n``ModelClass.objects.all()``.\n\n::\n\n    Urls:\n\n        # urls.py\n        urlpatterns = patterns('',\n            url(r'^table/', include(table.urls')),\n        )\n\n    Tables:\n\n        # tables.py\n        from table import Table\n        from table.columns import Column\n\n        class PersonTable(Table):\n            id = Column(field='id')\n            name = Column(field='name')\n\n            class Meta:\n                model = Person\n                ajax = True\n\nCustom Ajax\n```````````\n\nIf you want to customize base data, use ``ajax_source`` option and\nimplement your own Class-based View by subclassing ``FeedDataView``.\n\n::\n\n    Tables:\n\n        # tables.py\n        class PersonTable(Table):\n            id = Column(field='id')\n            name = Column(field='name')\n\n            class Meta:\n                model = Person\n                ajax = True\n                ajax_source = reverse_lazy('table_data')\n\n    Urls:\n\n        # urls.py\n        urlpatterns = patterns('',\n            url(r'^table/data/$', MyDataView.as_view(), name='table_data'),\n        )\n\n    Views:\n\n        # views.py\n        from table.views import FeedDataView\n        from app.tables import PersonTable\n\n        class MyDataView(FeedDataView):\n\n            token = PersonTable.token\n\n            def get_queryset(self):\n                return super(MyDataView, self).get_queryset().filter(id__gt=5)\n\nColumns\n-------\n\n-  Column\n\n-  Link Column\n\n-  Datetime Column\n\n-  Checkbox Column\n\n-  Sequence Column\n\n-  Calendar Column\n\nWidgets\n-------\n\n-  search-box\n\n-  info-label\n\n-  pagination\n\n-  length-menu\n\n-  exten-button(deprecated)\n\nAPI Reference\n-------------\n\n-  `wiki \u003chttps://github.com/shymonk/django-datatable/wiki/API-Reference\u003e`__\n\n.. |Build Status| image:: https://travis-ci.org/shymonk/django-datatable.svg?branch=master\n   :target: https://travis-ci.org/shymonk/django-datatable\n.. |PyPI| image:: https://img.shields.io/pypi/v/django-datatable.png\n   :target: https://pypi.python.org/pypi/django-datatable\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshymonk%2Fdjango-datatable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshymonk%2Fdjango-datatable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshymonk%2Fdjango-datatable/lists"}