Code Monkey home page Code Monkey logo

django-mr_reports's Introduction

Mr. Reports

Mr. Reports is a Django app to provide simple, opinionated* report generation (now called business intelligence) with attractive styling (using Bootstrap), and all the must-have report features like Excel and PDF downloads, and scheduled emails.

Reports, data connections, data sets (queries), and report parameters are all managed through the Django admin.

WARNING: This is in alpha mode so be careful. Also don't store important database passwords until the security code has been vetted.

How are the reports opinionated?

Just like Python itself, the philosophy here is easy things should be easy and hard things should be possible.

So this app makes a lot of decisions and defaults for you to save you time. For example, the results from your dataset (query) are rendered as a table on the report as is, there's no need to muck about with layout, name columns, etc.

(But if you do want to muck with the layout, each report allows custom CSS and Javascript.)

Detailed documentation is in the "docs" directory and [TODO]

Screenshots

A sample report:

mr_reports/docs/screenshots/sample_report.png?raw=true

Edit and create reports through Django's admin console:

mr_reports/docs/screenshots/editing_reports.png?raw=true

Editing a sample report:

mr_reports/docs/screenshots/editing_a_report.png?raw=true

Quick start

  1. Install:

    pip install django-mr_reports
    
  2. Add "mr_reports" to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = (
        'mr_reports',
    )
    
  3. Include the mr_reports URLconf in your project urls.py like this:

    url(r'^reports/', include('mr_reports.urls')),
    
  4. Make sure the Django admin is enabled and set up. That is how you'll edit/manage reports.

  5. Update your settings.py with additional settings as needed. See Settings section below.

  6. Run python manage.py syncdb to create the mr_reports models.

  7. Start the development server and visit http://127.0.0.1:8000/reports/ to see a listing of reports. Visit the admin panel to start writing reports.

  8. Install wkhtmltopdf to enable PDF export of reports.

  9. To enable scheduled reports/subscriptions:

  1. Make sure PDF export is set up and working
  2. Make sure email is set up for your Django project
  3. Set up a cron job to run this command periodically: python manage.py send_scheduled_reports

Updating settings.py

Make sure your SECRET_KEY is set. This is used to attempt to obscure database connection passwords.

It's best to make sure a timezone is set to make scheduled reports work correctly. Example: TIME_ZONE = 'America/New_York' USE_TZ = True

Other optional settings:

#Customize what goes on the bottom of all reports
MR_REPORTS_FOOTER_HTML = '<p><em>Report by Mr. Reports <a href="https://github.com/gregpinero">(Code)</a></em></p>'

#Use for PDF generation of reports
MR_REPORTS_WKHTMLTOPDF_PATH = '/path/to/wkhtmltopdf'
MR_REPORTS_WKHTMLTOPDF_OPTIONS = [
    '--javascript-delay', '1000',
]

In order for PDF export to work make sure to specify BASE_PATH in settings so wkhtmltopdf knows how to find the server. The server must be running at this URI in order for PDF export to work. Example:

BASE_PATH = 'http://10.101.10.172:8002/'

Experimental settings:

#Allow your report developing users (anyone with access to report/parameter objects on admin
#site) to execute Python code on your server.
#!!! Very dangereous, only enable if you know what you're doing !!!
MR_REPORTS_ALLOW_NATIVE_PYTHON_CODE_EXEC_ON_SERVER = False

django-mr_reports's People

Contributors

gregpinero 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.