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.
- Host: GitHub
- URL: https://github.com/audreyfeldroy/django-columns
- Owner: audreyfeldroy
- License: bsd-3-clause
- Created: 2014-05-12T20:45:56.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2022-12-26T19:45:00.000Z (over 2 years ago)
- Last Synced: 2025-02-25T00:28:07.389Z (3 months ago)
- Language: Python
- Size: 23.4 KB
- Stars: 30
- Watchers: 3
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.rst
- Changelog: HISTORY.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
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=masterDjango 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.