- New Features * Introduce CustomUser with role field and admin integration * Add ProjectMembership model linking users to projects * Add Ticket model with status, type, creator, and project relationships * Register CustomUser and ProjectMembership in Django admin with list views * Add URLs and views for account management and ticket CRUD operations - Enhancements * Provide pagination and filtering for ticket listings * Improve admin UI with role‑specific fieldsets - Bug Fixes * Remove obsolete serializers and placeholder files
32 lines
828 B
Python
32 lines
828 B
Python
from django.db import models
|
|
|
|
|
|
class Project(models.Model):
|
|
class Status(models.TextChoices):
|
|
PLANNING = "planning"
|
|
ACTIVE = "active"
|
|
REVIEW = "review"
|
|
DONE = "done"
|
|
|
|
name = models.CharField(max_length=255)
|
|
client = models.ForeignKey(
|
|
"accounts.CustomUser",
|
|
on_delete=models.CASCADE,
|
|
related_name="client_projects",
|
|
)
|
|
status = models.CharField(
|
|
max_length=20,
|
|
choices=Status.choices,
|
|
default=Status.PLANNING,
|
|
)
|
|
members = models.ManyToManyField(
|
|
"accounts.CustomUser",
|
|
through="accounts.ProjectMembership",
|
|
related_name="projects",
|
|
)
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
updated_at = models.DateTimeField(auto_now=True)
|
|
|
|
def __str__(self):
|
|
return self.name
|