Skip to main content

Generate content for rendering in Django templates in multiple vertically-sorted side-by-side columns

Project description

build docs codecov pypi pyvers licence black

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.

Comparison

Requirements

  • Python: 3.7, 3.8, 3.9

  • Django: 2.2, 3.0, 3.1, 3.2

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.

EvenView

CriteriaView lets you provide a list of functions, one per column, that VMC uses to determine which column an item will be placed in.

CriteriaView

DefinedView lets you provide the columns you want displayed. VMC does the rest.

DefinedView

Documentation

For more extensive document see the docs folder or read it in readthedocs.

Comments & Support

If you have questions about usage or development you can open an issue on GitHub. You can also contact Susan Wright directly.

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

django-vertical-multi-columns-1.0.0.tar.gz (229.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file django-vertical-multi-columns-1.0.0.tar.gz.

File metadata

  • Download URL: django-vertical-multi-columns-1.0.0.tar.gz
  • Upload date:
  • Size: 229.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for django-vertical-multi-columns-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c53e49d2d3c5633f7c995a997e35de81bae1b1953a07f0ef8ad476b6313131c3
MD5 491ea82a8997d83f9ebb18202bc36f2a
BLAKE2b-256 8624cc53cc9ea4c8b9380348b11241a306ff6b8962776373c0640e2c9e95eeb1

See more details on using hashes here.

File details

Details for the file django_vertical_multi_columns-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: django_vertical_multi_columns-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for django_vertical_multi_columns-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3af4427bee3243566b94a5ea7168d3878c53ea856324635ac68061df39003aba
MD5 bef4e912b5414008423308bf4ddd53a2
BLAKE2b-256 6f98aea2bd3514891d46b9c5ef71ccaca38b4d2225af4ab2a6219be6fd7d1d37

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page