Generate content for rendering in Django templates in multiple vertically-sorted side-by-side columns
Project description
Django-Vertical-Multi-Columns (VMC) is a reusable Django application allowing you to easily display a list of items in vertically sorted side-by-side columns rather than in one long list. It supports all JSON data types … string, number, boolean, object, array, and null/empty;.
Requirements
Python: 3.7, 3.8, 3.9
Django: 2.2, 3.0, 3.1
Installation
Install using pip:
pip install django-vertical-multi-columns
Add ‘vertical_multi_columns’ to your INSTALLED_APPS setting.
INSTALLED_APPS = [
...
'vertical_multi_columns',
]
In your Django settings, you can optionally specify a default number of columns to be generated.
VERTICAL_MULTI_COLUMNS = [
{NUMBER_OF_COLUMNS=3}
]
Why You May Need This
Displaying a long list of items in a template is quite easy.
{% for row in rows %} ... {{ row.<field> }} ... {% endfor %}
This comes at a cost for your end user though. Searching through a long list can test someone’s patience if it requires a lot of scrolling or paging.
What VMC Does
VMC views let you generate rows that can easily be displayed in multiple side-by-side columns in your templates. The columns retain your sort order so your users can still scan the data in a natural up-and-down way. And because the items are spread across the screen, your content takes less vertical space, reducing the amount of scrolling/paging a user must do.
You specify the number of columns you want generated.
VMC views are sub-classes of ListView so all its capabilities are still available to you.
View Options
There are 3 views available.
EvenView spreads your data across the number of columns you specify, keeping the length of the columns as even as possible.
CriteriaView lets you provide a list of functions, one per column, that VMC uses to determine which column an item will be placed in.
DefinedView lets you provide the columns you want displayed. VMC does the rest.
Documentation
For more extensive document see the docs folder or read it in readthedocs.
Special Thanks
To Graham Wright for his guidance and support in publishing this.
Project details
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
Hashes for django-vertical-multi-columns-0.9.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02e534e262d77c2cbabfd5d8b1588384322cee19e47b3090c9ce71759455b361 |
|
MD5 | 5cc2f9ec003066e674a5499f7ec18329 |
|
BLAKE2b-256 | 7cebff171335ad5967eb48a320746fbc59c2ccce7690adc363fb426baf18670c |
Hashes for django_vertical_multi_columns-0.9.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddfa9a8acf87dbf7ac88139952d030af78372b99e628db75955e329a79dfb9f8 |
|
MD5 | 83059f9383484883e9e26b07f7b24717 |
|
BLAKE2b-256 | a4bcfcc04dca8dee1c6d3d3478cb25496e9c0d1b24396e33e910310758b847a8 |
Comments & Support
If you have questions about usage or development you can participate in the discussion or open an issue on GitHub. You can also contact Susan Wright directly.