Django grid middleware
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
__pycache__
dist
gridiron.egg-info
migrations
templates/gridiron
templatetags
.gitignore
LICENSE
MANIFEST.in
__init__.py
admin.py
apps.py
models.py
readme.rst
setup.py
tests.py
views.py

readme.rst

Gridiron

Gridiron is middleware for front-end grid systems.

Quick start

  1. Add "polls" to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        'polls',
    ]
    
  2. Create a folder called "gridiron" in your project, and add the folder structure "templates/gridiron"

  3. Create grid_column.html and grid_row.html and add to this folder.

Grid Row:

<div {%if id %}id="{{id}}"{%endif%} class="mdl-grid {%if classname %}{{classname}}{%endif%}">
{{content}}

</div>

Grid Column:

<div {%if id %}id="{{id}}"{%endif%} class="mdl-cell {% for col in columns %}mdl-cell--{{col}}-col {% endfor %}{%if classname %}{{classname}}{%endif%}">
{{content}}

</div>

  1. Edit the contents to reflect the grid system you're using. Example for Boostrap:

Grid Row:

<div {%if id %}id="{{id}}"{%endif%} class="row {%if classname %}{{classname}}{%endif%}">
{{content}}

</div>

Grid Column:

<div {%if id %}id="{{id}}"{%endif%} class="{% for col in columns %}{{col}} {% endfor %}{%if classname %}{{classname}}{%endif%}">
{{content}}

</div>

  1. Usage:

    {% load gridiron %}

    {% grid_row "extra-class" %}

    {% grid_column "col-sm-12" "col-md-6" "col-lg-4" %}{% endcol %}

    {% endrow %}