mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2026-02-05 11:25:19 -05:00
feat: add passkey authentication and enhance user preferences - Add passkey login security event type with fingerprint icon - Include request and site context in email confirmation for backend - Add user_id exact match filter to prevent incorrect user lookups - Enable PATCH method for updating user preferences via API - Add moderation_preferences support to user settings - Optimize ticket queries with select_related and prefetch_related This commit introduces passkey authentication tracking, improves user profile filtering accuracy, and extends the preferences API to support updates. Query optimizations reduce database hits for ticket listings.
100 lines
2.7 KiB
Python
100 lines
2.7 KiB
Python
"""
|
|
Rich Choice Objects for Reviews Domain
|
|
|
|
This module defines all choice objects for the reviews domain,
|
|
using the RichChoices pattern for consistent UI rendering and validation.
|
|
"""
|
|
|
|
from apps.core.choices import ChoiceCategory, RichChoice
|
|
from apps.core.choices.registry import register_choices
|
|
|
|
# ============================================================================
|
|
# Rating Value Choices (1-5 stars)
|
|
# ============================================================================
|
|
RATING_VALUES = [
|
|
RichChoice(
|
|
value="1",
|
|
label="1 Star",
|
|
description="Poor rating",
|
|
metadata={
|
|
"color": "red",
|
|
"icon": "star",
|
|
"css_class": "bg-red-100 text-red-800",
|
|
"sort_order": 1,
|
|
"numeric_value": 1,
|
|
"star_count": 1,
|
|
},
|
|
category=ChoiceCategory.CLASSIFICATION,
|
|
),
|
|
RichChoice(
|
|
value="2",
|
|
label="2 Stars",
|
|
description="Below average rating",
|
|
metadata={
|
|
"color": "orange",
|
|
"icon": "star",
|
|
"css_class": "bg-orange-100 text-orange-800",
|
|
"sort_order": 2,
|
|
"numeric_value": 2,
|
|
"star_count": 2,
|
|
},
|
|
category=ChoiceCategory.CLASSIFICATION,
|
|
),
|
|
RichChoice(
|
|
value="3",
|
|
label="3 Stars",
|
|
description="Average rating",
|
|
metadata={
|
|
"color": "yellow",
|
|
"icon": "star",
|
|
"css_class": "bg-yellow-100 text-yellow-800",
|
|
"sort_order": 3,
|
|
"numeric_value": 3,
|
|
"star_count": 3,
|
|
},
|
|
category=ChoiceCategory.CLASSIFICATION,
|
|
),
|
|
RichChoice(
|
|
value="4",
|
|
label="4 Stars",
|
|
description="Good rating",
|
|
metadata={
|
|
"color": "lime",
|
|
"icon": "star",
|
|
"css_class": "bg-lime-100 text-lime-800",
|
|
"sort_order": 4,
|
|
"numeric_value": 4,
|
|
"star_count": 4,
|
|
},
|
|
category=ChoiceCategory.CLASSIFICATION,
|
|
),
|
|
RichChoice(
|
|
value="5",
|
|
label="5 Stars",
|
|
description="Excellent rating",
|
|
metadata={
|
|
"color": "green",
|
|
"icon": "star",
|
|
"css_class": "bg-green-100 text-green-800",
|
|
"sort_order": 5,
|
|
"numeric_value": 5,
|
|
"star_count": 5,
|
|
},
|
|
category=ChoiceCategory.CLASSIFICATION,
|
|
),
|
|
]
|
|
|
|
|
|
def register_reviews_choices() -> None:
|
|
"""Register all reviews domain choices with the global registry."""
|
|
register_choices(
|
|
name="rating_values",
|
|
choices=RATING_VALUES,
|
|
domain="reviews",
|
|
description="Rating values for reviews (1-5 stars)",
|
|
)
|
|
|
|
|
|
# Auto-register choices when module is imported
|
|
register_reviews_choices()
|