Skip to main content

Simplify excel reports from django apps

Project description

Quick guide:

Here is defined models for example:

from django.db import models


class MyFiles(models.Model):
    file = models.FileField(upload_to='path/to/upload/')
    description = models.TextField()


class M2MRelated(models.Model):
    field = models.TextField()


class RelatedModel:
    field = models.TextField()


class MyModel:
    field = models.TextField()
    related_model = models.ForeignKey(RelatedModel, models.DO_NOTHING)
    m2m_related = models.ManyToManyField(M2MRelated)

How to use BaseReport class:

from django_excel_report import BaseReport


class MyReport(BaseReport):
    model = MyModel
    fields = ["field", "related_model__field", "m2m_related__field"]

def some_task(**kwargs):
    qs = MyModel.objects.filter(**kwargs)
    report = MyReport(queryset=qs)
    file = report.get_django_file()
    instance = MyFiles.objects.create(description='description')
    instance.file.save('report.xlsx', file)

BaseReport class provides easy way to generate reports with merged cells for related objects:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_excel_report-0.0.6.tar.gz (9.6 kB view hashes)

Uploaded Source

Built Distribution

django_excel_report-0.0.6-py3-none-any.whl (9.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page