django-tables2-reports

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

django-tables2-reports Ranking & Summary

Advertisement

  • Rating:
  • License:
  • LGPL v3
  • Price:
  • FREE
  • Publisher Name:
  • Pablo Martin
  • Publisher web site:
  • http://grupoikusnet com

django-tables2-reports Tags


django-tables2-reports Description

django-tables2-reports is a Django app that allows you to get a CSV report of any table with minimal changes to your project.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 tablesclass MyTable(tables.Table): ...############### Now ######################from django_tables2_reports.tables import TableReportclass MyTable(TableReport): ...- Now you should use other RequestConfig:############### Before ###################from django_tables2 import RequestConfigdef 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 RequestConfigdef 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))UsageUnder 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 applicationYou 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 viewProduct's homepage


django-tables2-reports Related Software