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>
70 lines
2.0 KiB
Python
70 lines
2.0 KiB
Python
"""
|
|
User models for KeepItGoing.
|
|
"""
|
|
|
|
import uuid
|
|
from django.contrib.auth.models import AbstractUser
|
|
from django.db import models
|
|
|
|
|
|
class User(AbstractUser):
|
|
"""
|
|
Custom user model for KeepItGoing.
|
|
|
|
Uses email as the primary identifier instead of username.
|
|
"""
|
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
|
email = models.EmailField(unique=True)
|
|
|
|
# Profile fields
|
|
timezone = models.CharField(max_length=50, default='UTC')
|
|
avatar = models.ImageField(upload_to='avatars/', null=True, blank=True)
|
|
|
|
# Preferences
|
|
default_reminder_minutes = models.IntegerField(default=30)
|
|
email_notifications = models.BooleanField(default=True)
|
|
push_notifications = models.BooleanField(default=True)
|
|
|
|
# Timestamps
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
updated_at = models.DateTimeField(auto_now=True)
|
|
|
|
# Use email as the username field
|
|
USERNAME_FIELD = 'email'
|
|
REQUIRED_FIELDS = ['username']
|
|
|
|
class Meta:
|
|
db_table = 'users'
|
|
verbose_name = 'user'
|
|
verbose_name_plural = 'users'
|
|
|
|
def __str__(self):
|
|
return self.email
|
|
|
|
|
|
class DeviceToken(models.Model):
|
|
"""
|
|
Stores push notification tokens for user devices.
|
|
"""
|
|
PLATFORM_CHOICES = [
|
|
('android', 'Android'),
|
|
('web', 'Web'),
|
|
('desktop', 'Desktop'),
|
|
]
|
|
|
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
|
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='device_tokens')
|
|
platform = models.CharField(max_length=20, choices=PLATFORM_CHOICES)
|
|
token = models.TextField()
|
|
device_name = models.CharField(max_length=255, blank=True)
|
|
is_active = models.BooleanField(default=True)
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
updated_at = models.DateTimeField(auto_now=True)
|
|
|
|
class Meta:
|
|
db_table = 'device_tokens'
|
|
unique_together = ['user', 'token']
|
|
|
|
def __str__(self):
|
|
return f"{self.user.email} - {self.platform} - {self.device_name}"
|