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.
AccesoPersona is the visitor log for Planta Milenio, stored in the local SQLite database (planta.sqlite3). Every time a person enters the plant through the Control de Personas module, a new AccesoPersona record is created with hora_entrada set automatically to the current timestamp. When the visitor leaves, the operator registers the departure: hora_salida is set to the current time and tiempo_visita is calculated as the difference in minutes between entry and exit. Denied visits are handled at creation time — the record is saved immediately with hora_salida equal to the creation timestamp and tiempo_visita set to zero.
Model Definition
Fields
The visitor’s first name. Maximum 100 characters. Required at the model level and enforced as required in the entry form.
The visitor’s surname. Maximum 100 characters. Optional at the model level (
blank=True), though the entry form typically collects it.The visitor’s national identity document number. Maximum 50 characters. Required at the model level. Used by the autocomplete endpoint to pre-fill repeat visitors’ details.
The visitor’s company or organisation. Maximum 255 characters. Optional and nullable. Used by the autocomplete endpoint to pre-fill known companies associated with a given
cedula.The stated reason for the visit. Maximum 255 characters. Optional at the model level but treated as required in the entry form to ensure every record has an auditable purpose.
The name of the plant employee or manager who authorised the visit. Maximum 100 characters. Optional.
The approval status of the visit. Accepts one of two values:
aprobada (the visitor was allowed entry) or negada (the visitor was turned away). Defaults to aprobada. When set to negada at creation, the view automatically sets hora_salida to the current time and tiempo_visita to 0.The name of the plant employee the visitor is coming to see. Maximum 100 characters. Optional.
Timestamp set automatically to the current date and time when the record is created (
auto_now_add=True). Reflects the America/Caracas timezone (UTC-4) of the application server. This field is not editable after creation.Timestamp recorded when the visitor’s departure is registered. Null until the exit is processed. For denied visits this is set to the creation time immediately. Used together with
hora_entrada to calculate tiempo_visita.The license plate of the vehicle the visitor arrived in. Maximum 20 characters. Optional and nullable — visitors who arrive on foot leave this blank.
Duration of the visit in minutes, calculated on departure as
floor((hora_salida − hora_entrada).total_seconds() / 60). Null until exit is recorded, except for denied visits where it is set to 0 immediately at creation.Querying Examples
Usehora_salida__isnull=True to find visitors currently on-site, and the .update() path for recording departures to avoid race conditions from concurrent requests.
Denied Visit Behaviour
Whenestado_visita is set to 'negada' at the time of record creation, the view does not wait for a separate exit registration step. Instead, it immediately sets hora_salida to the current timestamp and tiempo_visita to 0. This means denied visits always appear as closed records in the visitor log and are never included in queries for currently active visitors (those with hora_salida__isnull=True).