reporting application for Django
Clone or download
Pull request Compare This branch is 23 commits ahead of vitalik:master.
Latest commit 9990f90 May 17, 2012
Type Name Latest commit message Commit time
Failed to load latest commit information.
reporting Added JqPlot to create Charts of the reports. May 17, 2012
samples/people_example added comments to samples Nov 14, 2009
.gitignore git ignore for git repo clone Dec 4, 2009
README.rst Update README.rst May 17, 2012 increase version on setup. May 17, 2012



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.


Clone repository and do:

python 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:

    'django.contrib.admin', # admin has to go before reporting in order to have links to the reports
                            # on the admin site

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

reporting.autodiscover()                                   # autodiscover reports in applications

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

Configure report

Let's say you have the following schema:

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

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','occupation'), # If a tupple is defined would group by all fields in the tupple
    list_filter = [                # This are report filter options (similar to django-admin)

    # if detail_list_display is defined user will be able to see how rows was grouped
    detail_list_display = [

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

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

Add an import of the in the __init__ of your application.

For more details see a 'samples' projects inside the repository.

More information