Skip to main content

Documentation 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.

Planta Milenio exposes HTTP endpoints consumed by its own frontend through AJAX calls and direct browser navigation. These endpoints fall into three categories: autocomplete endpoints that return JSON arrays for real-time form field suggestions, report endpoints that stream PDF file downloads, and view endpoints that serve full HTML pages for the web UI. All endpoints are served by Django 5.

Authentication

Authentication is performed by submitting a POST request to /login/ with the user’s nombre and password form fields. On success, Django sets a sessionid cookie that must be included in every subsequent request. Autocomplete endpoints for transport and logistics data (empresa, chuto, tanque, destino, conductor, producto) do not perform a session check in their view logic — they only require that the Django application is reachable. The six visitor/personnel autocomplete endpoints (/autocomplete/persona/…) also do not check session. PDF report endpoints vary: reporte_pdf_materia_prima checks for an active session and permiso_reportes; reporte_pdf_personal and reporte_historial do not perform a session check and are accessible without authentication.
All twelve autocomplete endpoints accept GET requests only. The six visitor/personnel endpoints (/autocomplete/persona/…) and /autocomplete/producto/ are decorated with @require_GET and will return 405 Method Not Allowed for any other HTTP method. The remaining transport endpoints (empresa, chuto, tanque, destino, conductor) are not decorated with @require_GET but are functionally read-only in the application.

CSRF Protection

Django’s CSRF middleware is active on all POST endpoints. Browser clients handle this automatically via the csrftoken cookie that Django sets on the first page load. For programmatic access, obtain the CSRF token from the csrftoken cookie after loading any page and pass it either in the X-CSRFToken request header or in the csrfmiddlewaretoken POST body field.

Login Example

# Step 1 — Load the login page to obtain a CSRF token
curl -c cookies.txt http://localhost:8000/login/

# Step 2 — Extract the CSRF token from the cookie jar, then log in
curl -c cookies.txt -b cookies.txt -X POST http://localhost:8000/login/ \
  -d 'nombre=operador1&password=mypassword&csrfmiddlewaretoken=<token>'

# Step 3 — Use the session cookie for subsequent requests to protected views
curl -b cookies.txt 'http://localhost:8000/autocomplete/empresa/?q=agro'

Endpoint Categories

Planta Milenio’s endpoints are organised into two primary API surface areas plus the HTML view layer.
CategoryBase PathResponse FormatAuth Requirement
Autocomplete/autocomplete/…JSON arrayNone (transport) / None (persona)
PDF Reports/reporte_pdf/…, /reporte_historial/application/pdfVaries — see individual endpoint notes
HTML Views/control/, /reportes/, etc.text/htmlActive session + per-module permission

Per-Module Permissions

Non-autocomplete views enforce per-module permissions stored on the authenticated user’s profile. If a user attempts to access a restricted view without the required permission, they are redirected to the login page. Autocomplete endpoints do not check module-level permissions.

Autocomplete Endpoints

Reference for all 12 GET autocomplete endpoints. Returns JSON arrays for company, vehicle, driver, product, destination, and visitor field suggestions.

PDF Report Endpoints

Reference for the three PDF report download endpoints that generate WeasyPrint PDFs for raw-material history and personnel access records.

Build docs developers (and LLMs) love