{ "info": { "author": "Ageu Matheus", "author_email": "ageumatheus1@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 2.2", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries :: Application Frameworks", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "djangotables\n===============\n\nDjangotables is a simple library for generating html\ntables with [Django Framework](https://www.djangoproject.com/) using\nmodel data like django forms.\n\n----------------------------------------------------------------------------------\n\nDjangotables is a simple yet powerful library. A library based on forms\ngenerated by Django, if you are already familiar with django forms it will\nbe very easy to use django tables, otherwise it will be easy anyway :wink:\n\nI had the idea of developing when I was developing a Dashboard and always had\nto write the tables several times in html :sleeping:\n\n## Installation\n\n\nSimple **djangotables** can be installed with pip::\n\n pip install djangotables\n\nRequirements\n----------------\n\n* Python ``3.6; 3.7``\n* Django ``2.0; 2.1; 2.2``\n\nThese are the officially supported python and package versions. Other versions\nwill probably work\n\nUsage\n----------------\n\nIt's very simple to use, you just have to import ``djangotables.tables`` on\nyour ``tables.py`` file and create your subclass like below.\n\n```python\n\nfrom djangotables import tables\n\nclass UserTable(tables.Table):\n first_name = tables.TextField(label=\"First Name\")\n last_name = tables.TextField(label=\"Last Name\")\n\n```\n\nSo, in your ``vews.py`` file, just import your table class and instantiate it\nby passing the queryset\n\n```python\n\nfrom .tables import UserTable\nfrom django.contrib.auth.models import User\n\nfrom django.shortcuts import render\n\ndef index(request):\n\n table = UserTable( User.objects.all() )\n\n return render( request, \"index.html\", {\n \"table\": table\n })\n\n```\n\nTo finish, on your ``index.html`` template file you just have to do this\n\n```html\n\n\n\n
... \n \n