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
Built Distribution
Close
Hashes for django_excel_report-0.0.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffc61b1d52b1ebc1dfc5f836d3a291fcbe92336b4d777d63caf5141a57b57ae7 |
|
MD5 | 7fbd38b5349030626904825e2f1eb2ea |
|
BLAKE2b-256 | 27afd59aa74ee0eba3cc9c3e3bf7fc7261e214490425c0f1baab63f0134fca04 |
Close
Hashes for django_excel_report-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd222d5d53aefbf12bcac5cd8cd7659ccf4148f1c98675e1b63e89055dc59441 |
|
MD5 | 4ff463584fb4b9aed76c9f34dd8f1d10 |
|
BLAKE2b-256 | f447ee15f84eca1e0c3b740729b804c4636d35818aa95f18a56da97050e036fd |