Planta Milenio generates PDF reports on demand using WeasyPrint. Each report endpoint queries the database, renders a Django HTML template, converts it to PDF in-process, and streams the result back to the client as a direct file download. All three endpoints respond withDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/JuanDiego3030/Planta_Milenio/llms.txt
Use this file to discover all available pages before exploring further.
Content-Type: application/pdf and a Content-Disposition: attachment header so that browsers prompt the user to save the file rather than attempting to display it inline.
Users with
solo_consulta enabled on their profile are permitted to
download PDF reports. The solo_consulta flag only blocks POST-based write
operations (registering or modifying entries). It does not restrict access to
report endpoints.Authentication Requirements
The three endpoints have different authentication requirements:| Endpoint | Session required | Permission required |
|---|---|---|
GET /reporte_pdf/materia_prima/ | Yes | permiso_reportes |
GET /reporte_pdf/personal/ | No | None |
GET /reporte_historial/ | No | None |
reporte_pdf_personal and reporte_historial do not perform any session or permission check in their view implementations — they are accessible to any request that reaches the Django application.
Shared Query Parameters
All three report endpoints accept the same optional date-range filter:Start date of the report range in
YYYY-MM-DD format, e.g. 2024-01-01.
Filtering is inclusive — records on this date are included.End date of the report range in
YYYY-MM-DD format, e.g. 2024-01-31.
Filtering is inclusive — records on this date are included (the system
applies a < fecha_fin + 1 day bound internally).GET /reporte_pdf/materia_prima/
Generates a PDF report of raw-material intake entries recorded in theHistorial model. This endpoint is restricted to users who hold the permiso_reportes permission on their profile. If the requesting user does not have an active session or lacks permiso_reportes, they are redirected to the /control/ view.
Auth: Active session + permiso_reportes permission required.
Behavior: Returns up to 200 records from the Historial model, ordered by fecha_hora descending. When fecha_inicio and fecha_fin are supplied, only records whose fecha_hora falls within the range are included.
Response headers:
| Header | Value |
|---|---|
Content-Type | application/pdf |
Content-Disposition | attachment; filename="reporte_materia_prima.pdf" |
Start date in
YYYY-MM-DD format. Optional.End date in
YYYY-MM-DD format. Optional.GET /reporte_pdf/personal/
Generates a PDF report of personnel and visitor access records from theAccesoPersona model. This endpoint does not check for an active session or any permission — it is accessible without authentication.
Auth: None required.
Behavior: Returns up to 200 records from AccesoPersona, ordered by hora_entrada descending. When fecha_inicio and fecha_fin are supplied, only records whose hora_entrada falls within the range are included.
Response headers:
| Header | Value |
|---|---|
Content-Type | application/pdf |
Content-Disposition | attachment; filename="reporte_personal.pdf" |
Start date in
YYYY-MM-DD format. Optional.End date in
YYYY-MM-DD format. Optional.GET /reporte_historial/
Generates a PDF of the full raw-material intake history from theHistorial model. When no date range is provided, this endpoint returns the last 100 records rather than an empty report, making it useful for a quick operational snapshot without needing to specify dates. This endpoint does not check for an active session or any permission — it is accessible without authentication.
Auth: None required.
Behavior: When fecha_inicio and fecha_fin are both provided, returns up to 200 records filtered by that range, ordered by fecha_hora descending. When either parameter is absent, returns the 100 most recent records (no date filtering applied).
Response headers:
| Header | Value |
|---|---|
Content-Type | application/pdf |
Content-Disposition | attachment; filename="reporte_historial.pdf" |
Start date in
YYYY-MM-DD format. Optional — if either date parameter is
absent, the last 100 records are returned instead of applying a date filter.End date in
YYYY-MM-DD format. Optional — if either date parameter is
absent, the last 100 records are returned instead of applying a date filter.Complete Download Example
The following sequence shows a full authenticated PDF download flow for the raw-material report (which requirespermiso_reportes) alongside the unauthenticated downloads: