An open API service indexing awesome lists of open source software.

https://github.com/audreyfeldroy/django-columns

Django template filter for splitting a list into columns.
https://github.com/audreyfeldroy/django-columns

Last synced: about 1 month ago
JSON representation

Django template filter for splitting a list into columns.

Awesome Lists containing this project

README

        

=============================
django-columns
=============================

.. image:: https://badge.fury.io/py/django-columns.png
:target: https://badge.fury.io/py/django-columns

.. image:: https://travis-ci.org/audreyr/django-columns.png?branch=master
:target: https://travis-ci.org/audreyr/django-columns

.. .. image:: https://coveralls.io/repos/audreyr/django-columns/badge.png?branch=master
.. :target: https://coveralls.io/r/audreyr/django-columns?branch=master

Django template filter for splitting a list into columns.

Documentation
-------------

The full documentation is at https://django-columns.readthedocs.org.

Quickstart
----------

1. Install the package. At the command line::

$ pip install django-columns

2. Add `columns` to `INSTALLED_APPS`.

3. Using django-columns is easy. Front-end developers and designers will
find it particularly useful.

To split a list into 2 lists, to fill 2 Bootstrap grid columns::

{% load columns %}


{% for col in mylist|columns:2 %}

{% for item in col %}
{{ item }}

{% endfor %}

{% endfor %}

Similarly, to split a list into 3 lists, to fill 3 columns::

{% load columns %}


{% for col in mylist|columns:3 %}

{% for item in col %}
{{ item }}

{% endfor %}

{% endfor %}

These examples use Bootstrap-style columns, but you can use any other grid
framework with django-columns.