mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2026-02-05 07:45:18 -05:00
Based on the git diff provided, here's a concise and descriptive commit message:
feat: add security event taxonomy and optimize park queryset - Add comprehensive security_event_types ChoiceGroup with categories for authentication, MFA, password, account, session, and API key events - Include severity levels, icons, and CSS classes for each event type - Fix park queryset optimization by using select_related for OneToOne location relationship - Remove location property fields (latitude/longitude) from values() call as they are not actual DB columns - Add proper location fields (city, state, country) to values() for map display This change enhances security event tracking capabilities and resolves a queryset optimization issue where property decorators were incorrectly used in values() queries.
This commit is contained in:
@@ -1,36 +1,14 @@
|
||||
from django.conf import settings
|
||||
from django.db import models
|
||||
|
||||
from apps.core.choices.fields import RichChoiceField
|
||||
from apps.core.history import TrackedModel
|
||||
|
||||
# Import choices to ensure registration on app load
|
||||
from . import choices # noqa: F401
|
||||
|
||||
|
||||
class Ticket(TrackedModel):
|
||||
STATUS_OPEN = "open"
|
||||
STATUS_IN_PROGRESS = "in_progress"
|
||||
STATUS_CLOSED = "closed"
|
||||
|
||||
STATUS_CHOICES = [
|
||||
(STATUS_OPEN, "Open"),
|
||||
(STATUS_IN_PROGRESS, "In Progress"),
|
||||
(STATUS_CLOSED, "Closed"),
|
||||
]
|
||||
|
||||
CATEGORY_GENERAL = "general"
|
||||
CATEGORY_BUG = "bug"
|
||||
CATEGORY_PARTNERSHIP = "partnership"
|
||||
CATEGORY_PRESS = "press"
|
||||
CATEGORY_DATA = "data"
|
||||
CATEGORY_ACCOUNT = "account"
|
||||
|
||||
CATEGORY_CHOICES = [
|
||||
(CATEGORY_GENERAL, "General Inquiry"),
|
||||
(CATEGORY_BUG, "Bug Report"),
|
||||
(CATEGORY_PARTNERSHIP, "Partnership"),
|
||||
(CATEGORY_PRESS, "Press/Media"),
|
||||
(CATEGORY_DATA, "Data Correction"),
|
||||
(CATEGORY_ACCOUNT, "Account Issue"),
|
||||
]
|
||||
|
||||
user = models.ForeignKey(
|
||||
settings.AUTH_USER_MODEL,
|
||||
on_delete=models.SET_NULL,
|
||||
@@ -40,10 +18,11 @@ class Ticket(TrackedModel):
|
||||
help_text="User who submitted the ticket (optional)",
|
||||
)
|
||||
|
||||
category = models.CharField(
|
||||
category = RichChoiceField(
|
||||
choice_group="ticket_categories",
|
||||
domain="support",
|
||||
max_length=20,
|
||||
choices=CATEGORY_CHOICES,
|
||||
default=CATEGORY_GENERAL,
|
||||
default="general",
|
||||
db_index=True,
|
||||
help_text="Category of the ticket",
|
||||
)
|
||||
@@ -51,7 +30,13 @@ class Ticket(TrackedModel):
|
||||
message = models.TextField()
|
||||
email = models.EmailField(help_text="Contact email", blank=True)
|
||||
|
||||
status = models.CharField(max_length=20, choices=STATUS_CHOICES, default=STATUS_OPEN, db_index=True)
|
||||
status = RichChoiceField(
|
||||
choice_group="ticket_statuses",
|
||||
domain="support",
|
||||
max_length=20,
|
||||
default="open",
|
||||
db_index=True,
|
||||
)
|
||||
|
||||
class Meta(TrackedModel.Meta):
|
||||
verbose_name = "Ticket"
|
||||
|
||||
Reference in New Issue
Block a user