Overview
The team management system allows you to create and maintain a roster of team members (encargados) who can be assigned to projects and tasks. Each team member record includes automatic timestamp tracking and soft-delete functionality to preserve historical data.Team members (encargados) are the foundation of the project management system. You must create team members before you can assign them to projects or tasks.
Understanding Team Members (Encargados)
The term “encargado” means “person in charge” or “responsible person” in Spanish. In Proyecto, encargados are:Project Leaders
Can be assigned as leaders of projects with overall responsibility
Project Team Members
Can be assigned to multiple projects as contributing team members
Task Assignees
Can be assigned individual tasks to complete
Organizational Resources
Represent the human resources available in your organization
The Encargado Data Model
Theencargado model in CTP/models.py defines the team member structure:
Model Fields
nombres (Names)- Type: Character field (max 100 characters)
- Nullable: Yes (can be blank)
- Purpose: Stores the team member’s full name
- Used as the string representation (
__str__) of the team member
fecha_registro- Automatically set to the date when the team member was addedhora_registro- Automatically set to the time when the team member was addedstatus- Boolean flag (True = active, False = deleted)
Adding Team Members
Creating new team members is straightforward:Creation Workflow
- Navigate to the Team Members section (
/trabajadores/) - Click to add a new team member
- Enter the team member’s full name in the nombres field
- Submit the form
Team Member Form
ThetrabajadoresForm in forms.py provides a simple interface:
Form Features
- Single Field - Only requires the team member’s name
- Bootstrap Styling - Uses form-control class for consistent UI
- Helpful Placeholder - “Ingresa el nombre” (Enter the name) guides users
- Django Validation - Automatic validation ensures data integrity
Managing Team Member Profiles
Once created, you can edit team member information:Edit Workflow
- From the team member listing, click edit for a team member
- The form loads with the current name pre-filled
- Modify the name if needed
- Save the changes
Editing a team member’s name automatically updates it everywhere they’re assigned - in project leadership, project teams, and task assignments.
Assigning Members to Projects and Tasks
Once team members are created, they become available for assignment:Project Leadership Assignment
Each project requires one leader:- Uses a
ForeignKeyrelationship in the Proyectos model - Select from dropdown:
lider = models.ForeignKey(encargado, on_delete=models.CASCADE, related_name='proyectos_lider') - One team member can lead multiple projects
Project Team Assignment
Projects can have multiple team members:- Uses a
ManyToManyFieldrelationship in the Proyectos model - Multi-select interface:
encargados = models.ManyToManyField(encargado, related_name='proyectos_encargados') - One team member can be on multiple project teams
- Project leader can also be included in the team members list
Task Assignment
Each task is assigned to one team member:- Uses a
ForeignKeyrelationship in the Tareas model - Select from dropdown:
encargados = models.ForeignKey(encargado, on_delete=models.CASCADE) - One team member can have multiple tasks assigned
Viewing Team Member Assignments
Viewing Team Member Assignments
To see all projects led by a team member, use the reverse relationship:
team_member.proyectos_lider.all()To see all projects where they’re a team member: team_member.proyectos_encargados.all()To see all their assigned tasks: team_member.tareas_set.all()Cascade Delete Protection
Cascade Delete Protection
The CASCADE setting means if you delete a team member, all their associated records are also deleted:
- Projects they lead
- Their project team memberships
- Tasks assigned to them
Viewing Team Member Listings
The team member listing displays all active members:Listing Display
The listing shows:- Team member names
- Registration date and time
- Available actions (edit, delete, view details, generate PDF)
Only active team members (status=True) appear in the listing and are available for assignment to projects and tasks.
Soft Delete Functionality
Team members use soft deletion to maintain data integrity:Soft Delete Process
- Select the delete action for a team member
- Confirm the deletion
- The system sets
status = Falseinstead of removing the record - The team member is hidden from listings and assignment dropdowns
- All historical data and relationships are preserved
Why Soft Delete for Team Members?
Historical Integrity
Preserves records of who led or worked on past projects and completed tasks
Audit Trail
Maintains complete history of team member involvement with timestamp data
Prevents Data Loss
Avoids cascade deletion of all projects and tasks associated with the team member
Recovery Option
Team members can be reactivated if deleted by mistake
PDF Report Generation
Generate PDF reports of your team roster:Team Listing PDF
- All active team members
- Sorted alphabetically by name
- Registration information
- Formatted for printing and distribution
User Interface Workflow
The team management interface uses action-based navigation:Available Actions
?action=agregar- Add a new team member?action=editar&id=X- Edit an existing team member?action=eliminar&id=X- Delete a team member (soft delete)?action=pdflistado- Generate PDF report of all team members?action=consultar&id=X- Query team member details via AJAX
AJAX Queries
The system supports dynamic loading of team member information:- Loading team member details without page refresh
- Displaying information in modals or popups
- More responsive user interactions
Security and Authentication
All team management operations require authentication:Protected Operations
You must be logged in to:- View the team member listing
- Add new team members
- Edit team member profiles
- Delete team members
- Generate PDF reports
- Query team member details
Best Practices
Naming Conventions
Team Member Management
- Create Before Assigning - Add all team members to the system before creating projects or tasks
- Regular Updates - Keep team member information current as your organization changes
- Careful Deletion - Review assignments before deleting team members to avoid losing context
- Consistent Naming - Establish a naming standard (First Last, or Last, First) and stick to it
Integration with Projects and Tasks
Pre-populate Team
Add all team members first, then create projects and tasks
Clear Roles
Use team member names that clearly identify who they are
Active Management
Regularly review and update your team roster as people join or leave
Transaction Safety
All team member operations use database transactions:- Data Consistency - All changes succeed or all fail together
- No Partial Updates - You never end up with incomplete records
- Error Recovery - Failed operations are automatically rolled back
- Database Integrity - Relationships remain valid even if errors occur
Transaction wrapping is especially important for team members because they’re referenced by projects and tasks through foreign key relationships.