Skip to main content

===== 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" %}
    

Release files for django-magic-tables 0.3.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-magic-tables 0.3.3.3
File Size Uploaded
django-magic-tables-0.3.3.3.tar.gz 4.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-magic-tables 0.3.3.3
File Interpreter ABI Platform
django_magic_tables-0.3.3.3-py3-none-any.whl Python 3 none any Details

Total release size: 9.4 kB

Release files / django-magic-tables-0.3.3.3.tar.gz

Download URL django-magic-tables-0.3.3.3.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
26d6da02f8814a1c53288ccf8792d9cfda55051cdfe61dee6c1f5f12f8c2601f
BLAKE2b-256 checksum
How to use checksums
e212ca8ca669a56ec428886a7fc1c0cd4a49fd25376dda6b63c6b2689b4d7e8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0.post20201221 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.9

Release files / django_magic_tables-0.3.3.3-py3-none-any.whl

Download URL django_magic_tables-0.3.3.3-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e71663adc6dcfad9adf643406f977ca6f3ff330730aab7542ee6fde1e6a710e
BLAKE2b-256 checksum
How to use checksums
0db8c4af24470190c913d13cf76eb868baf3c9177833633f8707acd9631a02f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0.post20201221 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.9
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page