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.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sinpapel_reports-0.2.1.tar.gz | 32.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sinpapel_reports-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 61.9 kB
Release files / sinpapel_reports-0.2.1.tar.gz
| Download URL | sinpapel_reports-0.2.1.tar.gz |
|---|---|
| Size | 32.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
58724d0051ec6ace094c41e68eef4bfb0eb76e3732674550cdad5b352b345db7
|
|
BLAKE2b-256 checksum How to use checksums |
ef5e3099a600075e8a438a2a63acff9d28fc32e70e06afb9c68cee6d2577827d
|
| 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.1-py3-none-any.whl
| Download URL | sinpapel_reports-0.2.1-py3-none-any.whl |
|---|---|
| Size | 29.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7eee58adf6c051d93fa58d6086ff22e75804c002c9004c5d384345a0b9482c4e
|
|
BLAKE2b-256 checksum How to use checksums |
5ee5f63706e78d12f54e5522416fa49fc2a98ab4c45f81b4e83e9cc06357c684
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|