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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb71e17d35f10d4e54ad0f880df27b4ce235cb3c061da62f84520de0ea5a9997 |
|
MD5 | ee32a9af7b1b213b66c5571e3cc169b9 |
|
BLAKE2b-256 | 95dbc8fd91ec7616fcdd2cf380294391930cf2976ed3fcdf44e7b7fcc2e2162d |
Close
Hashes for django_excel_report-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 200e1d177572812f2ef88c6193b0fc3ab34ab3daa582b66d04b688bfd38fc260 |
|
MD5 | f97bd1affd7c968be78e9170f6b1a17c |
|
BLAKE2b-256 | fb09e3ebb89e25ae0eaca268be68ede8f51a8c93eb39cdab705c232fa442c634 |