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 + pypdf) 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.4

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.4
File Size Uploaded
sinpapel_reports-0.2.4.tar.gz 33.7 kB Details

Built distribution (wheel)

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

Total release size: 62.9 kB

Release files / sinpapel_reports-0.2.4.tar.gz

Download URL sinpapel_reports-0.2.4.tar.gz
Size 33.7 kB
Tags Source
SHA-256 checksum
How to use checksums
48d5df67db92d782f23b0521259fa634c6cfe8ad93f3f9a21e5c8248df0286ad
BLAKE2b-256 checksum
How to use checksums
cb8df6a9563b8971565f8dc809bbc2ad5ed5c7bd579879630ff4333f28cc9837
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

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

Download URL sinpapel_reports-0.2.4-py3-none-any.whl
Size 29.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
28a0df7bd2183df090b831231fd67d9afc2d85bc3792ee3f211846bd932e4d1e
BLAKE2b-256 checksum
How to use checksums
e260d0c796cb6618caf83671e2402dd8c497bae8e4f9d7069905949f8d51f982
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

0.2.4 This release

2 release files

0.2.3

2 release files

0.2.2

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