TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/LucPinheiro/gestor-tarea-django/llms.txt
Use this file to discover all available pages before exploring further.
Tarea model is the single database table that powers Gestor de Tareas Django. Every task created, edited, filtered, or exported by the application is stored as a row in this table. Understanding its fields, choice constants, and constraints is the starting point for any backend work on this project.
Model Definition
The full class is defined intareas/models.py. Two module-level lists — ESTADOS and PRIORIDADES — supply the allowed values for the estado and prioridad fields respectively.
models.py
Field Reference
Each field listed below corresponds directly to a column in thetareas_tarea database table. Fields marked required must be provided on create/update; fields marked optional may be omitted or left blank.
The title of the task. Stored as a
VARCHAR(100) column. Maximum length of 100 characters; no default value — must be supplied by the caller or the form.A free-form text body for the task. Stored as a
TEXT column with no length limit. No default value — must be supplied.The current workflow state of the task. Stored as a
VARCHAR(20). Constrained to the four values defined in ESTADOS (see table below). Defaults to 'Borrador' when not provided.The timestamp at which the task was created. Set automatically by Django via
auto_now_add=True — it is written once on INSERT and never updated. This field is not editable through forms or the API; any value passed in is silently ignored by Django.The numeric priority of the task. Constrained to the three integer values defined in
PRIORIDADES (see table below). Defaults to 1 ('Baja') when not provided.An optional deadline date for the task. Stored as a
DATE column. Both null=True and blank=True are set, meaning the column accepts NULL in the database and the field may be omitted from forms without a validation error.Valid Values
ESTADOS — Task States
Theestado field accepts only these four string values. The stored value (written to the database) and the display label are identical for all states.
| Stored Value | Display Label |
|---|---|
Borrador | Borrador |
Pendiente | Pendiente |
En proceso | En proceso |
Completada | Completada |
PRIORIDADES — Task Priorities
Theprioridad field accepts only these three integer values. The integer is stored in the database; the label is used for display in templates and the admin.
| Stored Value (integer) | Display Label |
|---|---|
1 | Baja |
2 | Media |
3 | Alta |
ModelForm — TareaForm
TareaForm is a ModelForm defined in tareas/forms.py. It is used by both the crear_tarea and editar_tarea views to validate and persist task data. The form exposes five of the six model fields; fecha_creada is intentionally excluded because Django sets it automatically via auto_now_add=True.
forms.py
form-control, form-select) and, where appropriate, an HTML placeholder. The fecha_limite widget sets type="date" to trigger the browser’s native date-picker.
fecha_creada is not included in TareaForm.Meta.fields. Attempting to pass it in POST data has no effect — Django’s ModelForm will ignore fields not declared in fields.Database
The table is managed entirely by Django migrations. Key storage details are listed below.| Property | Value |
|---|---|
| Backend | SQLite (django.db.backends.sqlite3) — configured in mi_proyecto/settings.py |
| Database file | BASE_DIR / 'db.sqlite3' (project root) |
| Table name | tareas_tarea — Django convention: <app_label>_<model_name> |
| Primary key | id — auto-incrementing BigAutoField, sourced from DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' in settings |
prioridad and fecha_limite fields were added in migration 0005_tarea_fecha_limite_tarea_prioridad (tareas/migrations/0005_tarea_fecha_limite_tarea_prioridad.py). If you are working with an older database snapshot, run python manage.py migrate to apply all pending migrations before testing these fields.