mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-29 01:47:00 -05:00
feat: Add user leaderboard API, Cloudflare Turnstile integration, and support ticket categorization.
This commit is contained in:
@@ -13,6 +13,22 @@ class Ticket(TrackedModel):
|
||||
(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,
|
||||
@@ -22,6 +38,13 @@ class Ticket(TrackedModel):
|
||||
help_text="User who submitted the ticket (optional)"
|
||||
)
|
||||
|
||||
category = models.CharField(
|
||||
max_length=20,
|
||||
choices=CATEGORY_CHOICES,
|
||||
default=CATEGORY_GENERAL,
|
||||
db_index=True,
|
||||
help_text="Category of the ticket"
|
||||
)
|
||||
subject = models.CharField(max_length=255)
|
||||
message = models.TextField()
|
||||
email = models.EmailField(help_text="Contact email", blank=True)
|
||||
@@ -39,10 +62,11 @@ class Ticket(TrackedModel):
|
||||
ordering = ["-created_at"]
|
||||
|
||||
def __str__(self):
|
||||
return f"[{self.get_status_display()}] {self.subject}"
|
||||
return f"[{self.get_category_display()}] {self.subject}"
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
# If user is set but email is empty, autofill from user
|
||||
if self.user and not self.email:
|
||||
self.email = self.user.email
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user