File python-django-tables2.spec of Package python-django-tables2

#
# spec file for package python-django-tables2
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/


Name:           python-django-tables2
Version:        1.2.6
Release:        0
License:        as is 
Summary:        Table/data-grid framework for Django
Url:            https://github.com/bradleyayers/django-tables2/
Group:          Development/Languages/Python
Source:         https://pypi.python.org/packages/f8/ec/cfae47f41c3c73e70627585dc1ee6af61587bb5f0fe51b5af11f374a3c55/django-tables2-%{version}.tar.gz
BuildRequires:  python-devel
BuildRequires:  python-setuptools
BuildRequires:  python-Django >= 1.8
Requires:       python-Django >= 1.8
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
django-tables2 - An app for creating HTML tables
------------------------------------------------

.. image:: https://badge.fury.io/py/django-tables2.svg
    :target: https://pypi.python.org/pypi/django-tables2
    :alt: Latest PyPI version

.. image:: https://travis-ci.org/bradleyayers/django-tables2.svg?branch=master
    :target: https://travis-ci.org/bradleyayers/django-tables2
    :alt: Travis CI

django-tables2 simplifies the task of turning sets of data into HTML tables. It
has native support for pagination and sorting. It does for HTML tables what
`django.forms` does for HTML forms. e.g.

.. image:: http://dl.dropbox.com/u/33499139/django-tables2/example.png
    :alt: An example table rendered using django-tables2

Its features include:

- Any iterable can be a data-source, but special support for Django querysets is included.
- The builtin UI does not rely on JavaScript.
- Support for automatic table generation based on a Django model.
- Supports custom column functionality via subclassing.
- Pagination.
- Column based table sorting.
- Template tag to enable trivial rendering to HTML.
- Generic view mixin.

About the app:

- `Available on pypi <https://pypi.python.org/pypi/django-tables2>`_
- Tested with python 2.7, 3.3, 3.4, 3.5 and Django 1.8, 1.9, `Travis CI <https://travis-ci.org/bradleyayers/django-tables2>`_
- `Documentation on readthedocs.org <https://django-tables2.readthedocs.io/en/latest/>`_
- `Bug tracker <http://github.com/bradleyayers/django-tables2/issues>`_

Example
-------

Start by adding ``django_tables2`` to your ``INSTALLED_APPS`` setting like this:

.. code:: python

        INSTALLED_APPS = (
            ...,
            'django_tables2',
        )

Creating a table for a model `Simple` is as simple as:

.. code:: python

    import django_tables2 as tables

    class SimpleTable(tables.Table):
        class Meta:
            model = Simple

This would then be used in a view:

.. code:: python

    def simple_list(request):
        queryset = Simple.objects.all()
        table = SimpleTable(queryset)
        return render(request, 'simple_list.html', {'table': table})

And finally in the template:

.. code::

    {% load django_tables2 %}
    {% render_table table %}

This example shows one of the simplest cases, but django-tables2 can do a lot more!
Check out the `documentation <https://django-tables2.readthedocs.io/en/latest/>`_ for more details.


%prep
%setup -q -n django-tables2-%{version}

%build
python setup.py build

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}

%files
%defattr(-,root,root,-)
%doc LICENSE README.rst CHANGELOG.md
%{python_sitelib}/*

%changelog
openSUSE Build Service is sponsored by