Internal
Public Access
Implement recurring tasks functionality
Adds automatic creation of next task instance when recurring tasks are completed. - Add calculate_next_due_date() and create_next_recurrence() methods to Task model - Update task completion handlers in views and sync API to create next recurrence - Add hourly Celery task to process any missed recurring tasks - Support daily, weekly, biweekly, monthly, yearly recurrence patterns - Respect recurrence_end_date limits 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.5
parent
c51fd846a2
commit
1d6b07bfed
@@ -425,6 +425,9 @@ class TaskDetailView(View):
|
||||
task.title = request.POST.get('title', task.title)
|
||||
task.description = request.POST.get('description', '')
|
||||
|
||||
# Track old status to detect completion
|
||||
old_status = task.status
|
||||
|
||||
# Validate status against allowed choices
|
||||
status = request.POST.get('status', task.status)
|
||||
valid_statuses = [choice[0] for choice in Task.STATUS_CHOICES]
|
||||
@@ -451,6 +454,10 @@ class TaskDetailView(View):
|
||||
else:
|
||||
task.recurrence = 'none'
|
||||
|
||||
# Create next recurrence if task is being marked as completed
|
||||
if old_status != 'completed' and task.status == 'completed' and task.recurrence != 'none':
|
||||
task.create_next_recurrence()
|
||||
|
||||
task.save()
|
||||
|
||||
# Handle tags
|
||||
@@ -564,7 +571,13 @@ def task_toggle_status(request, task_id):
|
||||
if task.status == 'completed':
|
||||
task.status = 'pending'
|
||||
else:
|
||||
# Mark as completed
|
||||
task.status = 'completed'
|
||||
|
||||
# Create next recurrence if this is a recurring task
|
||||
if task.recurrence != 'none':
|
||||
task.create_next_recurrence()
|
||||
|
||||
task.save()
|
||||
|
||||
next_url = request.POST.get('next', 'dashboard')
|
||||
|
||||
Reference in New Issue
Block a user