Django-datatable-view

Latest version: v2.1.6

Safety actively analyzes 621854 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 4

0.9.0

This release officially supports Django 1.11, 2.0, and 2.1, and Python 2.7, 3.5, and 3.6.

Added TimeColumn
With support of the Django 2-series, we've added a missing TimeColumn to handle the built-in field. In the future, we intend to look at new ways of handling built-in fields and column registration to minimize such issues.

Notes about the future
If you conform to the new Datatable object-style configuration system, having migrated away from legacy ``datatable_options`` dict syntax, you will be able to skip this release and move to 1.0 when it is made available. 0.9 and 1.0 will have parity at release, except that legacy syntaxes will be unrecognized in 1.0.

Please see the 0.9 migration guide provided below if you need help converting to 1.0-style configurations ahead of actually making the jump to 1.0:

https://django-datatable-view.readthedocs.io/en/latest/migration-guide.html

Please note that as of the time of this release, we do not have a live public demo server to interact with. The example project is included in the release, however, which contains additional short examples and code for the various ways to configure and display a table. Brief instructions for running that example project are found in the README.

0.9.0beta.6

Streamlined ``datatableview.js`` API
We are now using the proper ``DataTable`` "modern" API from datatables.js.

The modern JS API changes the option names and query parameter names. We've updated those as far as the server-side stuff is concerned, but you should check any options you send to the JS constructors to ensure they match the official, modern datatables API.

The global JS hook ``window.confirm_datatable_options()`` is one step closer to its removal. ``datatableview.checkGlobalConfirmHook`` will default to true for the time being, which will signal the new hook ``datatableview.finalizeOptions(datatable, options)`` to check for the global hook. In 1.1, ``checkGlobalConfirmHook`` will default to false, and in 1.2, ``checkGlobalConfirmHook`` will be removed entirely and ``finalizeOptions()`` will be an empty hook for you to do with as you please.

This update aliases names that followed Pythonic naming conventions so that things are more Javascripty:

* ``datatableview.auto_initialize`` to ``datatableview.autoInitialize``
* ``datatableview.make_xeditable`` to ``datatableview.makeXEditable``

The underscore names will be removed in 1.2, simultaneous to the removal of ``datatableview.checkGlobalConfirmHook`` and code for consulting the global hook ``window.confirm_datatable_options()``.

QuerySet Caching

An official set of options exists to do automatic queryset caching on a per-View, per-User basis. For querysets that are a little too heavy for their own good, a caching strategy offers a straightforward optimization. There's not a good way to fix a bad queryset, but something is better than nothing!

Once configured to use of your Django ``settings.CACHES``, you may opt in a datatable class to use caching via its ``Meta.cache_type`` setting. Using the default ``cache_types.SIMPLE`` strategy, the queryset is placed directly in your cache for retrieval on subsequent requests. If that isn't fast enough, you can use ``cache_types.PK_LIST`` instead, which runs your query once to get the pks of the objects and stores that in the cache. Each request will have to run a ``WHERE `pk` IN (...)`` query but will be signficantly faster than evaluating the original queryset.

1. Set ``settings.DATATABLEVIEW_CACHE_BACKEND`` to an appropriate Django ``CACHES`` name.
2. Opt a python ``Datatable`` subclass into caching by setting ``Datatable.Meta.cache_type`` to one of the cache strategy constants importable at ``datatableview.datatables.cache_types``:
* ``cache_types.SIMPLE`` (``'simple'``): Stores the view's queryset directly
* ``cache_types.PK_LIST`` (``'pk_list'``): Stores only the list of pks from the view's queryset. Each new request will re-query the database with a (hopefully) simpler ``WHERE `pk` IN (...)`` query.
* ``cache_types.DEFAULT`` (``'default'``): Defers to ``settings.DATATABLEVIEW_DEFAULT_CACHE_TYPE`` for a cache strategy (which is ``SIMPLE`` by default).

Caching for a queryset is unique to the ``kwargs`` that come through the Datatable's ``get_cache_key_kwargs(self, **kwargs)``. If you need to add or remove items from the dict, modify the dict returned from ``super()`` to suit your needs.

By default, only three items are in the dict:

* ``datatable_class``: The Datatable doing the caching
* ``view``: The view using the Datatable
* ``user``: The view's ``request.user``

0.9.0beta.5

0.9.0beta.4

0.9.0beta.3

0.9.0beta.2

Page 1 of 4

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.