Coder Social home page Coder Social logo

jamesmura / django-model-report Goto Github PK

View Code? Open in Web Editor NEW

This project forked from juanpex/django-model-report

0.0 2.0 0.0 629 KB

django reports integrated with highcharts

Home Page: http://django-model-report.herokuapp.com

License: BSD 3-Clause "New" or "Revised" License

django-model-report's Introduction

Django Model Report

django reports integrated with highcharts

Demo

http://django-model-report.herokuapp.com

Installation

  • Add the model_report directory to your Python path.

  • Add model_report to your INSTALLED_APPS setting.

  • Create file "reports.py" within any application directory (just like admin.py).

  • Edit the file "reports.py" and register your reports like this:

      from app.models import Browser
      from model_report.report import reports, ReportAdmin
    
      class BrowserReport(ReportAdmin):
          title = _('Browser with Inline Downloads')
          model = Browser
          fields = [
              'name',
          ]
          list_order_by = ('name',)
          type = 'report'
    
      reports.register('browser-report', BrowserReport)
    
  • Activate your reports calling the autodiscover in urls.py (just like admin.py).

      from model_report import report
      report.autodiscover()
    
  • Add reports urls

    urlpatterns = patterns('', ... (r'', include('model_report.urls')), ... )

Configuration

Extend your reports from model_report.report import ReportAdmin

class ReportExample(ReportAdmin):
    pass
  • Atributes

    title:

    Title of the report.

    template_name:

    Template file name to render the report.

    exports:

    List of allowed export formats.

    Example:

      exports = ('excel', 'pdf')
    

    model:

    Django model

    fields:

    List of model fields to be listed.

    list_filter:

    List of fields to filter data.

    list_order_by:

    List of fields to order data.

    list_group_by:

    List of fields to group data.

    type:

    "report" for only report.

    "chart" for report and show chart graphic results.

    group_totals:

    Dictionary with field name as key and function to calculate their values. This row is displayed after each group as their totals.

    Example:

      group_totals = {
          'men': sum_column,
          'women': sum_column
      }
    

    report_totals:

    Dictionary with field name as key and function to calculate their values. This row is displayed at the end of the report as the totals of all results.

    Example:

      report_totals = {
          'men': avg_column,
          'women': avg_column
      }
    

    override_field_values:

    Dictionary with field name as key and function to parse their original values.

    Example:

      override_field_values = {
          'men': men_format,
          'women': women_format
      }
    

    override_field_formats:

    Dictionary with field name as key and function to parse their value after override_field_values.

    Example:

      override_field_formats = {
          'men': men_format,
          'women': women_format
      }
    

    override_field_labels:

    Dictionary with field name as key and function to parse the column label.

    Example:

      override_field_labels = {
          'men': men_label
      }
    

    list_serie_fields:

    List of fields to group by results in chart.

    chart_types:

    List of highchart types.

    Example:

      chart_types = ('pie', 'column')
    

    inlines:

    List of other's Report related to the main report.

Contribute

Clone the repo and help to be better this app :)

django-model-report's People

Contributors

juanpex avatar pkropf avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.