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
+35
-3
@@ -1,5 +1,37 @@
|
||||
"""generated with djinit"""
|
||||
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
|
||||
class Ticket(models.Model):
|
||||
class TicketType(models.TextChoices):
|
||||
BUG = "bug"
|
||||
FEATURE = "feature_request"
|
||||
SUPPORT = "support"
|
||||
|
||||
class Status(models.TextChoices):
|
||||
NEW = "new"
|
||||
ACKNOWLEDGED = "acknowledged"
|
||||
IN_PROGRESS = "in_progress"
|
||||
DONE = "done"
|
||||
REJECTED = "rejected"
|
||||
|
||||
creator = models.ForeignKey(
|
||||
"accounts.CustomUser",
|
||||
on_delete=models.CASCADE,
|
||||
related_name="created_tickets",
|
||||
)
|
||||
project = models.ForeignKey(
|
||||
"projects.Project",
|
||||
null=True,
|
||||
blank=True,
|
||||
on_delete=models.CASCADE,
|
||||
related_name="tickets",
|
||||
)
|
||||
title = models.CharField(max_length=255)
|
||||
description = models.TextField(blank=True)
|
||||
ticket_type = models.CharField(max_length=30, choices=TicketType.choices, default=TicketType.SUPPORT)
|
||||
status = models.CharField(max_length=30, choices=Status.choices, default=Status.NEW)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
def __str__(self):
|
||||
return f"[{self.ticket_type}] {self.title}"
|
||||
Reference in new issue
Block a user