A Django app to turn easily QuerySets into tables
Project description
===== Magic Tables
Magic Tables is a Django app to turn QuerySets into any kind of table.
Detailed documentation is in the "docs" directory.
Quick start
-
Install package
::
$ pip install django-magic-tables'
-
Add "magic_tables" to your INSTALLED_APPS setting like this:
::
INSTALLED_APPS = [ ... 'magic_tables', ]
-
Load "magic_tables_tags" at the top of the page where you want to use them like this:
::
{% load magic_tables_tags %} [...]
-
Create a magic table:
::
[...] {% table object_list "optional classes separated by spaces" %} [...]
Use it with Datatable
-
Include CSS
::
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.21/css/dataTables.bootstrap4.min.css"> <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/responsive/2.2.4/css/responsive.bootstrap4.min.css">
-
Include JS
::
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.21/js/jquery.dataTables.js"></script> <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.21/js/dataTables.bootstrap4.min.js"></script> <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/responsive/2.2.4/js/dataTables.responsive.min.js"></script> <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/responsive/2.2.4/js/responsive.bootstrap4.min.js"></script> <script> $(document).ready( function () { $('.data-table').DataTable( { 'language': { 'lengthMenu': '_MENU_ Results for page', 'zeroRecords': 'No results', 'info': 'Page _PAGE_ of _PAGES_', 'infoEmpty': 'No results', 'infoFiltered': '(Filtered on _MAX_ total results)', 'search': 'Search: ', 'paginate': { 'first': 'First', 'last': 'Last', 'next': 'Next', 'previous': 'Previous' } }, 'initComplete': () => { $('.data-table').fadeIn(); $('.graph').fadeIn(); } } ); } ); </script>
-
Pass "data-table" as second parameter to the table tag like this:
::
{% table object_list "data-table" %}
-
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for django-magic-tables-0.3.2.8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57808ad71ec78e5de26019e793c8b6688889ce734a1068cecf18193623be475b |
|
MD5 | 4423c676ee0bfc1076e92dd8f1dab779 |
|
BLAKE2b-256 | 618a6fdd39e7eb1096e57d817b550e50bb58f16f2e8980098802cca325a23e4f |
Close
Hashes for django_magic_tables-0.3.2.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c46ab6a8737477beda0127736a13513af27a7de55900d5127a9f1ee463f2c881 |
|
MD5 | 4b8d2c5c0bce253a51dcf73641b2d39d |
|
BLAKE2b-256 | 8d33f7e1ccb46977fcef34dbe65b63fda0e9a52efd06bbad235dbef7e6372212 |