Giter Site home page Giter Site logo

swright573 / django-vertical-multi-columns Goto Github PK

View Code? Open in Web Editor NEW
1.0 4.0 1.0 348 KB

Django package to enable ListView to easily generate sorted columns of data for display in a template.

License: BSD 2-Clause "Simplified" License

Python 90.33% HTML 9.67%
django columns sorted listview

django-vertical-multi-columns's Introduction

Django-Vertical-Multi-Columns

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.

django-vertical-multi-columns's People

Contributors

swright573 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

pickeringpete

django-vertical-multi-columns's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.