This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Django Reporting is an application that can be integrated with the Django Admin and allows you to create dynamic reports for your models. It is able to consolidate and aggregate data, filter and sort it.

New features

  • Django 1.3 support.
  • Group by more than one field, using tuples.
  • Export report data in a CSV file.
  • Generate jqPlot pie or bar charts from report’s columns.

Installation

Clone repository and do:

python setup.py install

Or just do

pip install django-reporting

to get the latest version from pypi.

How to use it

Add to INSTALLED_APPS in an existing django project:

settings.py

INSTALLED_APPS = (
    [...]
    'reporting',
    'django.contrib.admin', # admin has to go before reporting in order to have links to the reports
                            # on the admin site
)

urls.py

from django.conf.urls.defaults import *
from django.contrib import admin
import reporting                                           # import the module

admin.autodiscover()
reporting.autodiscover()                                   # autodiscover reports in applications

urlpatterns = patterns('',
    [...]
    (r'^reporting/', include('reporting.urls')),
)

Configure report

Let’s say you have the following schema:

models.py

class Department(models.Model):
    [...]

class Occupation(models.Model):
    [...]

class Person(models.Model):
    name = models.CharField(max_length=255)
    occupation = models.ForeignKey(Occupation)
    department = models.ForeignKey(Department)
    country = models.ForeignKey(Country)
    birth_date = models.DateField()
    salary = models.DecimalField(max_digits=16, decimal_places=2)
    expenses = models.DecimalField(max_digits=16, decimal_places=2)

In your application create a reports.py

reports.py:

import reporting
from django.db.models import Sum, Avg, Count
from models import Person

class PersonReport(reporting.Report):
    model = Person
    verbose_name = 'Person Report'
    annotate = (                    # Annotation fields (tupples of field, func, title)
        ('id', Count, 'Total'),     # example of custom title for column
        ('salary', Sum),            # no title - column will be "Salary Sum"
        ('expenses', Sum),
    )
    aggregate = (                   # columns that will be aggregated (syntax the same as for annotate)
        ('id', Count, 'Total'),
        ('salary', Sum, 'Salary'),
        ('expenses', Sum, 'Expenses'),
    )
    group_by = [                   # list of fields and lookups for group-by options
        'department',
        ('department','occupation'), # If a tupple is defined would group by all fields in the tupple
        'department__leader',
        'occupation',
    ]
    list_filter = [                # This are report filter options (similar to django-admin)
       'occupation',
       'country',
    ]

    # if detail_list_display is defined user will be able to see how rows was grouped
    detail_list_display = [
        'name',
        'salary',
        'expenses',
    ]

    date_hierarchy = 'birth_date' # the same as django-admin


reporting.register('people', PersonReport) # Do not forget to 'register' your class in reports

For more details see a ‘samples’ projects inside the repository.

More information

Date:

05-17-2012

Version:

0.2

Authors:
Website:

https://github.com/tryolabs/django-reporting

Release History

Release History

0.21

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-reporting-0.21.tar.gz (10.3 kB) Copy SHA256 Checksum SHA256 Source Jun 18, 2012

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting