Skip to content

Latest commit

 

History

History
61 lines (48 loc) · 2.24 KB

README.rst

File metadata and controls

61 lines (48 loc) · 2.24 KB

django-sheets

Use Google Sheets as context variables in Django templates

https://travis-ci.org/georgewhewell/django-sheets.svg?branch=master https://coveralls.io/repos/georgewhewell/django-sheets/badge.svg?branch=master Requirements Status

Usage

In your template:

{% load sheets %}
{% csv "1uPsdcGUnUsf3d2xGHRGUUb7_k5IQPtBvfQY61u8Z8wE" as data %}
<table>
    <thead>
        <tr>
        {% for header in data.headers %}
            <th>{{ header }}</th>
        {% endfor %}
        </tr>
    </thead>
    <tbody>
        {% for row in data.rows %}
        <tr>
            {% for cell in row %}
                <td>{{ cell }}</td>
            {% endfor %}
        </tr>
        {% endfor %}
    </tbody>
</table>

View the output, you should see

Origin (English) Name (English) Origin (Native) Name (Native)
Australia Nicole Kidman Australia Nicole Kidman
Austria Johann Strauss Österreich Johann Strauß
Belgium (Flemish) Rene Magritte België René Magritte
Belgium (French) Rene Magritte Belgique René Magritte
Belgium (German) Rene Magritte Belgien René Magritte

Documentation

Documentation is available at https://django-sheets.readthedocs.org.