feat(apps): add role‑based CustomUser admin and ticketing system
- 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
This commit is contained in:
37 files changed
+954
-126
No files matched your search
+49
-3
@@ -1,5 +1,51 @@
|
||||
"""generated with djinit"""
|
||||
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
|
||||
class Issue(models.Model):
|
||||
class Status(models.TextChoices):
|
||||
OPEN = "open"
|
||||
IN_PROGRESS = "in_progress"
|
||||
RESOLVED = "resolved"
|
||||
CLOSED = "closed"
|
||||
|
||||
class Priority(models.TextChoices):
|
||||
LOW = "low"
|
||||
MEDIUM = "medium"
|
||||
HIGH = "high"
|
||||
|
||||
project = models.ForeignKey(
|
||||
"projects.Project",
|
||||
on_delete=models.CASCADE,
|
||||
related_name="issues",
|
||||
)
|
||||
reporter = models.ForeignKey(
|
||||
"accounts.CustomUser",
|
||||
on_delete=models.CASCADE,
|
||||
related_name="reported_issues",
|
||||
)
|
||||
assignee = models.ForeignKey(
|
||||
"accounts.CustomUser",
|
||||
null=True,
|
||||
blank=True,
|
||||
on_delete=models.SET_NULL,
|
||||
related_name="assigned_issues",
|
||||
)
|
||||
title = models.CharField(max_length=255)
|
||||
description = models.TextField(blank=True)
|
||||
status = models.CharField(max_length=20, choices=Status.choices, default=Status.OPEN)
|
||||
priority = models.CharField(max_length=20, choices=Priority.choices, default=Priority.MEDIUM)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.title
|
||||
|
||||
|
||||
class IssueComment(models.Model):
|
||||
issue = models.ForeignKey(Issue, on_delete=models.CASCADE, related_name="comments")
|
||||
author = models.ForeignKey("accounts.CustomUser", on_delete=models.CASCADE)
|
||||
body = models.TextField()
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
def __str__(self):
|
||||
return f"Comment by {self.author} on {self.issue}"
|
||||
Reference in new issue
Block a user