Metadata-Version: 2.1
Name: djangotables
Version: 0.0.3
Summary: Djangotables is a simple library for generating html tables with Django Framework using model data like django forms.
Home-page: https://github.com/AgeuMatheus/djangotables
Author: Ageu Matheus
Author-email: ageumatheus1@gmail.com
Maintainer: Ageu Matheus
Maintainer-email: ageumatheus1@gmail.com
License: MIT License
Project-URL: Changelog, https://github.com/AgeuMatheus/djangotables/blob/master/HISTORY.md
Keywords: django,tables,djangotables
Platform: UNKNOWN
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 2.2
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: Django (>=2)

djangotables
===============

Djangotables is a simple library for generating html
tables with [Django Framework](https://www.djangoproject.com/) using
model data like django forms.

----------------------------------------------------------------------------------

Djangotables is a simple yet powerful library. A library based on forms
generated by Django, if you are already familiar with django forms it will
be very easy to use django tables, otherwise it will be easy anyway :wink:

I had the idea of developing when I was developing a Dashboard and always had
to write the tables several times in html :sleeping:

## Installation


Simple **djangotables** can be installed with pip::

    pip install djangotables

Requirements
----------------

* Python ``3.6; 3.7``
* Django ``2.0; 2.1; 2.2``

These are the officially supported python and package versions.  Other versions
will probably work

Usage
----------------

It's very simple to use, you just have to import ``djangotables.tables`` on
your ``tables.py`` file and create your subclass like below.

```python

from djangotables import tables

class UserTable(tables.Table):
    first_name = tables.TextField(label="First Name")
    last_name  = tables.TextField(label="Last Name")

```

So, in your ``vews.py`` file, just import your table class and instantiate it
by passing the queryset

```python

from .tables import UserTable
from django.contrib.auth.models import User

from django.shortcuts import render

def index(request):

    table = UserTable( User.objects.all() )

    return render( request, "index.html", {
        "table": table
    })

```

To finish, on your ``index.html`` template file you just have to do this

```html

<!DOCTYPE html>
<html lang="en">
    <head> ... </head>
    <body>
        <table>
            {{ table | safe }}
        </table>
    </body>
</html>

```

Okay, this is how simple you can use djangotables to improve
your daily development, feel free to contribute and help me
make this little library bigger

----------------------------------------------------------------------------------

Okay


