11webstack-django-sorting
22=======================
33
4- ``webstack-django-sorting `` allows for easy sorting of data tables and it
5- provides sorting links for table headers. It is the perfect
6- companion of `django-pagination <https://github.com/zyga/django-pagination >`_.
4+ What?
5+ -----
6+
7+ ``webstack-django-sorting `` is a Django app which allows for easy sorting of
8+ data tables. You don't need to change anything to your views to use it. It
9+ provides sorting links for table headers. It is the perfect companion of
10+ `django-pagination <https://github.com/zyga/django-pagination >`_.
711
812A demonstration of the features is provided in `testproj ` directory.
913
14+ Features
15+ --------
16+
17+ - Django ORM or Python sorting
18+ - Switches between ascending, descending, and no sorting
19+ - Provides links to sort on different criterions
20+ - Visual feedback on applied ordering
21+ - Supports Python 2.7, 3.5 and 3.6
22+ - Supports translation of link titles
23+
24+ Upgrade from v0.5.0 and below
25+ -----------------------------
26+
1027To upgrade to ``webstack-django-sorting `` v1.0.0+, you must remove the old middleware
1128``webstack_django_sorting.middleware.SortingMiddleware `` from ``MIDDLEWARE_CLASSES `` list.
1229
13- How to install it in your project
30+ How to use it in your project
1431---------------------------------
1532
16- The 5 steps to use `` webstack-django-sorting `` in your Django project:
33+ 1. `` pip install webstack_django_sorting ``
1734
18- 1 . Add the application to the ``INSTALLED_APPS `` list::
35+ 2 . Add the application to the ``INSTALLED_APPS `` list::
1936
2037 INSTALLED_APPS = [
2138 # ...
2239 'webstack_django_sorting',
2340 ]
2441
25- 2 . Check the request context processor is loaded in ``TEMPLATES `` options::
42+ 3 . Check the request context processor is loaded in ``TEMPLATES `` options::
2643
2744 TEMPLATES = [
2845 {
@@ -39,16 +56,16 @@ The 5 steps to use ``webstack-django-sorting`` in your Django project:
3956 },
4057 ]
4158
42- 3 . Add this line at the top of your template to load the sorting tags::
59+ 4 . Add this line at the top of your template to load the sorting tags::
4360
4461 {% load sorting_tags %}
4562
46- 4 . Decide on a variable that you would like to sort, and use the
63+ 5 . Decide on a variable that you would like to sort, and use the
4764 autosort tag on that variable before iterating over it::
4865
4966 {% autosort object_list %}
5067
51- 5 . Now, you want to display different headers with links to sort
68+ 6 . Now, you want to display different headers with links to sort
5269 your objects_list::
5370
5471 <tr>
0 commit comments