A comprehensive Django task management module with role-based access control
Project description
Django Task Management Module
A comprehensive, reusable Django module for task management with role-based access control, department hierarchy, and customizable workflows.
Features
Core Functionality
- Task Management: Create, assign, track, and manage tasks with status and priority
- Role-Based Access Control: Admin, Manager, and Employee roles with granular permissions
- Department Hierarchy: Organize users and tasks by departments
- Task Comments: Collaborative commenting system (configurable)
- Status Tracking: Customizable task status workflows
- Priority Management: Configurable priority levels
- Due Date Tracking: Automatic overdue detection
- Dashboard: Role-based dashboard with statistics
Integration Features
- Reusable Module: Install as a Django package or copy module files
- Configurable Settings: Extensive customization through Django settings
- Custom User Model: Optional custom user model with role support
- Template Override: Override default templates with your own
- URL Namespacing: Configurable URL patterns with namespace support
- Integration Validation: Built-in validation for proper integration
Quick Start
Installation
pip install django-task-management
Or copy the accounts/, tasks/, and task_management/ directories to your project.
Basic Integration
- Add to INSTALLED_APPS:
# settings.py
INSTALLED_APPS = [
# ... your existing apps
'accounts',
'tasks',
]
- Configure Authentication (optional):
AUTH_USER_MODEL = 'accounts.User'
LOGIN_URL = 'task_management:login'
LOGIN_REDIRECT_URL = 'task_management:dashboard'
LOGOUT_REDIRECT_URL = 'task_management:login'
- Include URLs:
# urls.py
urlpatterns = [
# ... your existing URLs
path('tasks/', include('task_management.urls')),
]
- Run Migrations:
python manage.py makemigrations
python manage.py migrate
- Validate Integration:
python manage.py validate_task_management_integration
Configuration
Custom Settings
# settings.py
# Accounts configuration
TASK_MANAGEMENT_ACCOUNTS = {
'ROLE_CHOICES': [
('admin', 'Administrator'),
('manager', 'Department Manager'),
('employee', 'Team Member'),
],
'DEFAULT_ROLE': 'employee',
'ALLOW_CROSS_DEPARTMENT_ASSIGNMENT': False,
}
# Tasks configuration
TASK_MANAGEMENT_TASKS = {
'STATUS_CHOICES': [
('draft', 'Draft'),
('pending', 'Pending'),
('in_progress', 'In Progress'),
('completed', 'Completed'),
],
'PRIORITY_CHOICES': [
('low', 'Low'),
('medium', 'Medium'),
('high', 'High'),
],
'ALLOW_COMMENTS': True,
'AUTO_COMPLETE_ON_STATUS_CHANGE': True,
}
# URL configuration
TASK_MANAGEMENT_URL_NAMESPACE = 'task_management'
TASK_MANAGEMENT_USE_NAMESPACE = True
Custom Templates
Create your own templates to override defaults:
your_project/
├── templates/
│ ├── accounts/
│ │ ├── login.html
│ │ ├── dashboard.html
│ │ └── profile.html
│ └── tasks/
│ ├── task_list.html
│ ├── task_detail.html
│ ├── task_form.html
│ └── task_confirm_delete.html
Custom Styling
Set custom template base in settings:
TASK_MANAGEMENT_ACCOUNTS = {
'ACCOUNT_TEMPLATE_BASE': 'myapp/base.html',
}
TASK_MANAGEMENT_TASKS = {
'TASK_TEMPLATE_BASE': 'myapp/base.html',
}
Usage
Creating Users and Departments
from accounts.models import Department, User
# Create department
dept = Department.objects.create(name="IT", description="IT Department")
# Create users
admin = User.objects.create_user(
username="admin",
email="admin@example.com",
password="password",
role="admin",
first_name="Admin",
last_name="User"
)
manager = User.objects.create_user(
username="manager",
email="manager@example.com",
password="password",
role="manager",
department=dept,
first_name="Manager",
last_name="User"
)
employee = User.objects.create_user(
username="employee",
email="employee@example.com",
password="password",
role="employee",
department=dept,
first_name="Employee",
last_name="User"
)
Creating Tasks
from tasks.models import Task
from django.utils import timezone
from datetime import timedelta
# Create task
task = Task.objects.create(
title="Implement new feature",
description="Add user authentication to the application",
created_by=manager,
assigned_to=employee,
department=dept,
priority="high",
due_date=timezone.now() + timedelta(days=7)
)
Role-Based Permissions
# Check user role
user.is_admin # True for administrators
user.is_manager # True for department managers
user.is_employee # True for regular employees
# Check permissions
user.can_assign_tasks() # Can assign tasks to others
user.can_assign_to_user(other_user) # Can assign to specific user
# Get managed users
managed_users = user.get_managed_users() # Users this user can assign tasks to
Task Queries
# Get tasks for user
user_tasks = Task.get_user_tasks(user) # Tasks visible to user
# Get department tasks
dept_tasks = Task.get_department_tasks(department)
# Check task status
task.is_overdue # True if past due date and not completed
task.days_remaining # Days until due date
URL Patterns
Authentication URLs
/login/- User login/logout/- User logout/profile/- User profile/- Dashboard (role-based)
Task URLs
/tasks/- Task list with filters/tasks/my-tasks/- Employee's assigned tasks/tasks/create/- Create new task/tasks/<id>/- Task detail view/tasks/<id>/update/- Update task/tasks/<id>/delete/- Delete task/tasks/<id>/status/- Update task status
Integration with Existing Projects
Using Existing User Model
TASK_MANAGEMENT_ACCOUNTS = {
'USE_CUSTOM_USER_MODEL': False,
'USER_MODEL_NAME': 'auth.User', # or your custom user model
}
Custom Department Model
TASK_MANAGEMENT_ACCOUNTS = {
'DEPARTMENT_MODEL_NAME': 'myapp.Organization',
}
Disable Features
TASK_MANAGEMENT_TASKS = {
'ALLOW_COMMENTS': False, # Disable comments
'REQUIRE_ASSIGNEE': True, # Require assignee
'AUTO_COMPLETE_ON_STATUS_CHANGE': False, # Manual completion
}
Management Commands
Validate Integration
python manage.py validate_task_management_integration
Options:
--fix- Attempt to fix common configuration issues--verbose- Show detailed validation information
Create Sample Data
# In Django shell
from accounts.models import Department, User
from tasks.models import Task
# Create sample departments and users
# ... your sample data creation code
Testing
Run Tests
python manage.py test accounts tasks
Test Configuration
# In your test settings
TASK_MANAGEMENT_ACCOUNTS = {
'USE_CUSTOM_USER_MODEL': True,
'ROLE_CHOICES': [
('admin', 'Admin'),
('manager', 'Manager'),
('employee', 'Employee'),
],
}
TASK_MANAGEMENT_TASKS = {
'ALLOW_COMMENTS': True,
'AUTO_COMPLETE_ON_STATUS_CHANGE': True,
}
Deployment
Production Settings
# Disable debug mode
DEBUG = False
# Set allowed hosts
ALLOWED_HOSTS = ['yourdomain.com']
# Configure static files
STATIC_ROOT = BASE_DIR / 'staticfiles'
python manage.py collectstatic
# Set up email for notifications
TASK_MANAGEMENT_TASKS = {
'SEND_NOTIFICATIONS': True,
}
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.your-provider.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'noreply@yourdomain.com'
EMAIL_HOST_PASSWORD = 'your-password'
Database Configuration
# PostgreSQL (recommended)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'task_management',
'USER': 'postgres',
'PASSWORD': 'your-password',
'HOST': 'localhost',
'PORT': '5432',
}
}
Troubleshooting
Common Issues
- Migration conflicts: Handle existing user models carefully
- URL conflicts: Ensure namespace doesn't conflict
- Template conflicts: Use unique template names
- Permission issues: Check role-based permissions
Debug Mode
# Enable detailed logging
LOGGING = {
'loggers': {
'accounts': {
'level': 'DEBUG',
},
'tasks': {
'level': 'DEBUG',
},
},
}
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
For support and questions:
- Check the integration guide:
INTEGRATION_GUIDE.md - Run validation:
python manage.py validate_task_management_integration --verbose - Check the troubleshooting section
- Create an issue on the repository
Changelog
Version 1.0.0
- Initial release
- Role-based access control
- Department hierarchy
- Configurable settings
- Template override support
- Integration validation
- Management commands
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_task_management-1.0.1.tar.gz.
File metadata
- Download URL: django_task_management-1.0.1.tar.gz
- Upload date:
- Size: 34.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ed5b935e087beb90570f627419e537242023bde5982639dbb939d00a8127443
|
|
| MD5 |
9371a73bfacda090468fe601d1d30688
|
|
| BLAKE2b-256 |
fc5e77451fe837abf8578f7707147bc1838d0c48bb1f916ff217da067f123612
|
Provenance
The following attestation bundles were made for django_task_management-1.0.1.tar.gz:
Publisher:
publish.yml on yashguptaepicinfocus-backend/Task-Management
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_task_management-1.0.1.tar.gz -
Subject digest:
9ed5b935e087beb90570f627419e537242023bde5982639dbb939d00a8127443 - Sigstore transparency entry: 944015371
- Sigstore integration time:
-
Permalink:
yashguptaepicinfocus-backend/Task-Management@044bb410b85bbc6d2978144494387d6d2c02d2f7 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/yashguptaepicinfocus-backend
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@044bb410b85bbc6d2978144494387d6d2c02d2f7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file django_task_management-1.0.1-py3-none-any.whl.
File metadata
- Download URL: django_task_management-1.0.1-py3-none-any.whl
- Upload date:
- Size: 39.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d36c9d08020849bd8b8e7d17bdbcb7e152c43f86f19bdf83723e5c633ba5415
|
|
| MD5 |
d73ffb7b31d55633d6a3c55d8cc52a48
|
|
| BLAKE2b-256 |
e4f6af04bd21debff47b332dd6cb763d46467e9e1228ced992256a2b74f98f66
|
Provenance
The following attestation bundles were made for django_task_management-1.0.1-py3-none-any.whl:
Publisher:
publish.yml on yashguptaepicinfocus-backend/Task-Management
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_task_management-1.0.1-py3-none-any.whl -
Subject digest:
4d36c9d08020849bd8b8e7d17bdbcb7e152c43f86f19bdf83723e5c633ba5415 - Sigstore transparency entry: 944015375
- Sigstore integration time:
-
Permalink:
yashguptaepicinfocus-backend/Task-Management@044bb410b85bbc6d2978144494387d6d2c02d2f7 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/yashguptaepicinfocus-backend
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@044bb410b85bbc6d2978144494387d6d2c02d2f7 -
Trigger Event:
push
-
Statement type: