Overview
The task management system allows you to create, assign, and track individual tasks (tareas) within your organization. Each task is assigned to a specific team member and includes automatic timestamp tracking and soft-delete capabilities.Tasks are designed for individual assignments. Each task is assigned to one team member (encargado) who is responsible for completing it.
Creating Tasks
Creating a task involves defining two core elements:Task Name
A descriptive name that identifies what needs to be done
Assigned Member
The team member responsible for completing the task
Task Creation Workflow
- Navigate to the Tasks section (
/Tareas/) - Click to add a new task
- Complete the task form:
- Task Name (
nombre_tarea) - Must be unique - Assigned Member (
encargados) - Select the responsible team member
- Task Name (
- Submit the form to create the task
Task Data Model
TheTareas model in CTP/models.py defines the task structure:
Understanding Task Assignment
Single Member Assignment (ForeignKey) Tasks use aForeignKey relationship to the encargado model:
- Each task is assigned to exactly one team member
- This creates clear accountability for task completion
- If the assigned team member is deleted, the task is also deleted (CASCADE)
- One team member can have multiple tasks assigned to them
Automatic Timestamps
Every task automatically tracks:- Registration Date (
fecha_registro) - The day the task was created - Registration Time (
hora_registro) - The exact time the task was created - Status (
status) - Boolean indicating if the task is active or deleted
ModeloBase and set automatically when you create a task.
Editing and Managing Tasks
You can modify existing tasks after creation:Edit Workflow
- From the task listing, select the edit action for a task
- The system loads the current task data
- Modify the task:
- Change the task name
- Reassign to a different team member
- Save your changes
All edit operations are wrapped in database transactions to ensure data consistency. If validation fails, no changes are saved to the database.
Task Form and Validation
TheTareasForm in forms.py provides structure and validation:
Form Features
- Task Name Field - Text input with Bootstrap styling
- Assigned Member Field - Dropdown select populated with active team members
- Automatic Validation - Django form validation ensures data integrity
- Custom Styling - Form controls use Bootstrap CSS classes for consistent UI
Task Status Tracking
Tasks maintain their active/inactive status through the inheritedstatus boolean field:
Active Tasks
status = True(default when created)- Visible in all task listings
- Included in PDF reports
- Available for editing and reassignment
Inactive Tasks
status = False(after soft delete)- Hidden from standard listings
- Preserved in database for audit trail
- Can be queried by administrators if needed
Viewing Task Listings
The task listing page displays all active tasks with complete details:Listing Display
The task listing shows:- Task name
- Assigned team member name
- Registration date and time
- Actions (edit, delete, view details, generate PDF)
Only active tasks (status=True) appear in the main listing. Deleted tasks are filtered out automatically.
Task Deletion (Soft Delete)
Like projects, tasks use soft deletion to preserve data:Soft Delete Process
- Select the delete action for a task
- Confirm the deletion
- The system sets
status = Falseinstead of removing the record - The task disappears from all standard listings
- All historical data remains in the database
Why Soft Deletion?
Historical Records
Historical Records
Maintain complete task history even after deletion. This is valuable for reviewing what work was assigned and completed over time.
Audit Compliance
Audit Compliance
Combined with automatic timestamps, you have a full audit trail of task creation and deletion dates.
Data Relationships
Data Relationships
Preserves the relationship between tasks and team members, maintaining referential integrity in your database.
Recovery Capability
Recovery Capability
Tasks can potentially be reactivated by changing status back to True if they were deleted by mistake.
Generating PDF Reports
You can generate PDF reports for tasks to create printable records:Task Listing PDF
Generate a complete PDF report of all active tasks:- All active tasks sorted by task name
- Task details including name and assigned member
- Formatted for printing and distribution
PDF generation uses Django templates (pdf/Tareas/listadoP.html) to format the report consistently with your organization’s needs.
User Interface Workflow
The task management interface follows a consistent action-based pattern:Available Actions
All task operations use URL parameters:?action=agregar- Create a new task?action=editar&id=X- Edit an existing task?action=eliminar&id=X- Delete a task (soft delete)?action=pdflistado- Generate PDF report of all tasks?action=consultar&id=X- View task details via AJAX
GET vs POST Operations
GET Requests - Display forms and views:- Show the task creation form
- Show the task edit form with pre-filled data
- Display the deletion confirmation
- Generate and display PDF reports
- Return JSON data for AJAX queries
- Save new tasks to the database
- Update existing tasks
- Perform soft deletion
- Handle form validation and error messages
AJAX Task Queries
The system supports AJAX requests for dynamic task information:- Load task details without page refresh
- Display task information in modals or popups
- Provide a more responsive user experience
Security and Authentication
All task management operations require user authentication:Protected Operations
You must be logged in to:- View the task listing
- Create new tasks
- Edit existing tasks
- Delete tasks
- Generate PDF reports
- Query task details
Best Practices
Unique Task Names
Always use descriptive, unique names for tasks to avoid confusion and duplicate detection errors.
Clear Assignments
Assign tasks to the team member who will actually complete the work for clear accountability.
Regular Reviews
Review your task listings regularly to ensure assignments are current and tasks are being completed.
PDF Archives
Generate PDF reports periodically to maintain offline records of task assignments.