Internal
Public Access
Features: - Django-based REST API with web interface - Task management with tags, priorities, and due dates - Time tracking with start/stop timers - Subtasks support - Task filtering (all, today, upcoming, overdue, completed) - Tag-based organization with color coding - Sorting by due date and priority - Auto-assign tags when filtering - Responsive 3-pane layout (sidebar, task list, detail panel) - Task sharing between users - Mobile-responsive design with dark mode support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
71 lines
2.0 KiB
Python
71 lines
2.0 KiB
Python
"""
|
|
Notification models for KeepItGoing.
|
|
"""
|
|
|
|
import uuid
|
|
from django.conf import settings
|
|
from django.db import models
|
|
|
|
|
|
class Notification(models.Model):
|
|
"""
|
|
Stores notifications for users.
|
|
"""
|
|
NOTIFICATION_TYPES = [
|
|
('reminder', 'Task Reminder'),
|
|
('due_soon', 'Due Soon'),
|
|
('overdue', 'Overdue'),
|
|
('shared', 'Task Shared'),
|
|
('comment', 'Comment'),
|
|
]
|
|
|
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
|
user = models.ForeignKey(
|
|
settings.AUTH_USER_MODEL,
|
|
on_delete=models.CASCADE,
|
|
related_name='notifications'
|
|
)
|
|
notification_type = models.CharField(max_length=20, choices=NOTIFICATION_TYPES)
|
|
title = models.CharField(max_length=255)
|
|
message = models.TextField()
|
|
task = models.ForeignKey(
|
|
'tasks.Task',
|
|
on_delete=models.CASCADE,
|
|
null=True,
|
|
blank=True,
|
|
related_name='notifications'
|
|
)
|
|
is_read = models.BooleanField(default=False)
|
|
read_at = models.DateTimeField(null=True, blank=True)
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
|
|
class Meta:
|
|
db_table = 'notifications'
|
|
ordering = ['-created_at']
|
|
|
|
def __str__(self):
|
|
return f"{self.notification_type}: {self.title}"
|
|
|
|
|
|
class ScheduledReminder(models.Model):
|
|
"""
|
|
Tracks scheduled reminders for tasks.
|
|
"""
|
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
|
task = models.ForeignKey(
|
|
'tasks.Task',
|
|
on_delete=models.CASCADE,
|
|
related_name='scheduled_reminders'
|
|
)
|
|
remind_at = models.DateTimeField()
|
|
is_sent = models.BooleanField(default=False)
|
|
sent_at = models.DateTimeField(null=True, blank=True)
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
|
|
class Meta:
|
|
db_table = 'scheduled_reminders'
|
|
ordering = ['remind_at']
|
|
|
|
def __str__(self):
|
|
return f"Reminder for {self.task.title} at {self.remind_at}"
|