Skip to main content

sinpapel-reports

Pluggable, template-driven document generation (PDF overlay + DOCX) for the sinpapel ecosystem.

What it does

Render per-record documents by stamping live data onto a PDF template at pixel coordinates (ReportLab + PyPDF2) or filling a DOCX template (docxtpl). Output is persisted as sinpapel.InstanciaDocumento, optionally bundled as a ZIP.

Install

pip install sinpapel-reports

Add "sinpapel_reports" to INSTALLED_APPS (after "sinpapel").

Plug in your data

Declare a reports.py in any installed app:

from sinpapel_reports.data_sources import CampoReporte, register_data_source

@register_data_source
class SolicitudDataSource:
    name = "solicitud"
    def get_field_catalog(self):
        return [CampoReporte(key="folio", label="Folio")]
    def build_context(self, target):
        return {"folio": target.id}

Point a Documento.configuracion_overlay["data_source"] at "solicitud" and call ReportEngine.generar(documento, target).

REST (optional)

Install the drf extra and include("sinpapel_reports.drf.urls").

Endpoints (relative to the mount prefix):

Method Path Description
GET field-catalog/?source=<name> Field palette for the named data source
GET documentos/<pk>/overlay-config/ Read stored overlay config
PUT documentos/<pk>/overlay-config/ Persist overlay config (validated)
POST documentos/<pk>/generate/ Generate; returns {"instancia_id","filename"}
GET instancias/<pk>/download/ Download generated file as attachment

Auth: views require IsAuthenticated by default. Override via settings.SINPAPEL_REPORTS_PERMISSION_CLASSES.

Extensibility: register custom renderers with ReportEngine.register_renderer("XLSX", my_renderer).

License

GPL-3.0-or-later.

Metadata

Release files for sinpapel-reports 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sinpapel-reports 0.2.2
File Size Uploaded
sinpapel_reports-0.2.2.tar.gz 32.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sinpapel-reports 0.2.2
File Interpreter ABI Platform
sinpapel_reports-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 61.9 kB

Release files / sinpapel_reports-0.2.2.tar.gz

Download URL sinpapel_reports-0.2.2.tar.gz
Size 32.8 kB
Tags Source
SHA-256 checksum
How to use checksums
85b001032824fdd58b36726e0450f9c24fdce9567dc157505ec9932257613434
BLAKE2b-256 checksum
How to use checksums
eb4c2cab5036a86caa93e735ec5a692c6df642648dc62f9a439b5557936bf10d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / sinpapel_reports-0.2.2-py3-none-any.whl

Download URL sinpapel_reports-0.2.2-py3-none-any.whl
Size 29.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6acba1881226ca02839590387a55ce3fc4c1793597a2dd926566c073110add32
BLAKE2b-256 checksum
How to use checksums
f6213ab2c853b1473db58a62b0d5a84ddecce7c251eadfa5ae30098c83b7382d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release history Release notifications | RSS feed

0.2.4

2 release files

0.2.3

2 release files

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page