Skip to main content

With django-tables2-reports you can get a CSV report of any django-tables2 with minimal changes to your project

Project description

Django tables2 report

With django-tables2-reports you can get a CSV report of any table with minimal changes to your project

Requeriments

Installation

  • In your settings:

INSTALLED_APPS = (

    'django_tables2_reports',
)

MIDDLEWARE_CLASSES = (

    'django_tables2_reports.middleware.TableReportMiddleware',
)

Changes in your project

  • Now your table should extend of ‘TableReport’

############### Before ###################

import django_tables2 as tables


class MyTable(tables.Table):

    ...

############### Now ######################

from django_tables2_reports.tables import TableReport


class MyTable(TableReport):

    ...
  • Now you should use other RequestConfig:

############### Before ###################

from django_tables2 import RequestConfig


def my_view(request):
    objs = ....
    table = MyTable(objs)
    RequestConfig(request).configure(table)
    return render_to_response('app1/my_view.html',
                              {'table': table},
                              context_instance=RequestContext(request))

############### Now ######################

from django_tables2_reports.config import RequestConfigReport as RequestConfig

def my_view(request):
    objs = ....
    table = MyTable(objs)
    RequestConfig(request).configure(table)
    return render_to_response('app1/my_view.html',
                              {'table': table},
                              context_instance=RequestContext(request))

Usage

Under the table appear a CSV icon, if you click in this icon, you get a CSV report with every item of the table (without pagination). The ordering works!

Other way to use this application

You could not use the middleware and to change a little every view, you would get a more efficient code, but you would have to adapt every view

Releases

0.0.1 (2012-07-17)

  • Initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-tables2-reports-0.0.1.tar.gz (7.4 kB view details)

Uploaded Source

File details

Details for the file django-tables2-reports-0.0.1.tar.gz.

File metadata

File hashes

Hashes for django-tables2-reports-0.0.1.tar.gz
Algorithm Hash digest
SHA256 3cddb1b8cfd51bba07119b2398068f34edd43d9e78a2172779e28544dfd2100f
MD5 ecb2b0f59801a8588387d4931a270aa8
BLAKE2b-256 5ce9a589ba3dc16539c16644598a534c3c407ecd69900276227cd4073265538c

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page