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.

Download files

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

Source Distribution

sinpapel_reports-0.2.0.tar.gz (32.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sinpapel_reports-0.2.0-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

Details for the file sinpapel_reports-0.2.0.tar.gz.

File metadata

  • Download URL: sinpapel_reports-0.2.0.tar.gz
  • Upload date:
  • Size: 32.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for sinpapel_reports-0.2.0.tar.gz
Algorithm Hash digest
SHA256 89e4c7f23c8157bb0eac40ff1564fe8252ccb92c6644ae4c49e7d6a454522b6f
MD5 a199c0815aeda7528b8a82bd00f617ce
BLAKE2b-256 0f14c13185e00c9c8c22aedbee48a81191d3985e1373553e6e52e6e11997dd0c

See more details on using hashes here.

File details

Details for the file sinpapel_reports-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sinpapel_reports-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b81fcfd399180721956e22e35aaf0703c0ab8bc90dd6398e529021b9e43c6ed0
MD5 933a35cf1156e18e3f64f7f164ee14b5
BLAKE2b-256 febf4ebebf54608c15b0280b4479a8f865c8f819e31f3012db015282f7797b39

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page