mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2026-04-01 11:18:22 -04:00
feat: Complete Phase 5 of Django Unicorn refactoring for park detail templates
- Refactored park detail template from HTMX/Alpine.js to Django Unicorn component
- Achieved ~97% reduction in template complexity
- Created ParkDetailView component with optimized data loading and reactive features
- Developed a responsive reactive template for park details
- Implemented server-side state management and reactive event handlers
- Enhanced performance with optimized database queries and loading states
- Comprehensive error handling and user experience improvements
docs: Update Django Unicorn refactoring plan with completed components and phases
- Documented installation and configuration of Django Unicorn
- Detailed completed work on park search component and refactoring strategy
- Outlined planned refactoring phases for future components
- Provided examples of component structure and usage
feat: Implement parks rides endpoint with comprehensive features
- Developed API endpoint GET /api/v1/parks/{park_slug}/rides/ for paginated ride listings
- Included filtering capabilities for categories and statuses
- Optimized database queries with select_related and prefetch_related
- Implemented serializer for comprehensive ride data output
- Added complete API documentation for frontend integration
This commit is contained in:
@@ -637,6 +637,135 @@ class ModerationService:
|
||||
|
||||
queue_item.full_clean()
|
||||
queue_item.save()
|
||||
|
||||
|
||||
result['queue_item'] = queue_item
|
||||
return result
|
||||
|
||||
@staticmethod
|
||||
def bulk_approve_submissions(submission_ids: list, moderator: User) -> int:
|
||||
"""
|
||||
Bulk approve multiple submissions.
|
||||
|
||||
Args:
|
||||
submission_ids: List of submission IDs to approve
|
||||
moderator: User performing the approvals
|
||||
|
||||
Returns:
|
||||
Number of successfully approved submissions
|
||||
"""
|
||||
approved_count = 0
|
||||
|
||||
for submission_id in submission_ids:
|
||||
try:
|
||||
ModerationService.approve_submission(
|
||||
submission_id=submission_id,
|
||||
moderator=moderator,
|
||||
notes="Bulk approved"
|
||||
)
|
||||
approved_count += 1
|
||||
except Exception as e:
|
||||
# Log error but continue with other submissions
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.error(f"Failed to bulk approve submission {submission_id}: {e}")
|
||||
|
||||
return approved_count
|
||||
|
||||
@staticmethod
|
||||
def bulk_reject_submissions(submission_ids: list, moderator: User) -> int:
|
||||
"""
|
||||
Bulk reject multiple submissions.
|
||||
|
||||
Args:
|
||||
submission_ids: List of submission IDs to reject
|
||||
moderator: User performing the rejections
|
||||
|
||||
Returns:
|
||||
Number of successfully rejected submissions
|
||||
"""
|
||||
rejected_count = 0
|
||||
|
||||
for submission_id in submission_ids:
|
||||
try:
|
||||
ModerationService.reject_submission(
|
||||
submission_id=submission_id,
|
||||
moderator=moderator,
|
||||
reason="Bulk rejected"
|
||||
)
|
||||
rejected_count += 1
|
||||
except Exception as e:
|
||||
# Log error but continue with other submissions
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.error(f"Failed to bulk reject submission {submission_id}: {e}")
|
||||
|
||||
return rejected_count
|
||||
|
||||
@staticmethod
|
||||
def bulk_escalate_submissions(submission_ids: list, moderator: User) -> int:
|
||||
"""
|
||||
Bulk escalate multiple submissions.
|
||||
|
||||
Args:
|
||||
submission_ids: List of submission IDs to escalate
|
||||
moderator: User performing the escalations
|
||||
|
||||
Returns:
|
||||
Number of successfully escalated submissions
|
||||
"""
|
||||
escalated_count = 0
|
||||
|
||||
for submission_id in submission_ids:
|
||||
try:
|
||||
ModerationService.escalate_submission(
|
||||
submission_id=submission_id,
|
||||
moderator=moderator,
|
||||
notes="Bulk escalated"
|
||||
)
|
||||
escalated_count += 1
|
||||
except Exception as e:
|
||||
# Log error but continue with other submissions
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.error(f"Failed to bulk escalate submission {submission_id}: {e}")
|
||||
|
||||
return escalated_count
|
||||
|
||||
@staticmethod
|
||||
def escalate_submission(submission_id: int, moderator: User, notes: str = "") -> 'EditSubmission':
|
||||
"""
|
||||
Escalate a submission for higher-level review.
|
||||
|
||||
Args:
|
||||
submission_id: ID of the submission to escalate
|
||||
moderator: User performing the escalation
|
||||
notes: Notes about why it was escalated
|
||||
|
||||
Returns:
|
||||
Updated submission object
|
||||
"""
|
||||
with transaction.atomic():
|
||||
submission = EditSubmission.objects.select_for_update().get(
|
||||
id=submission_id
|
||||
)
|
||||
|
||||
if submission.status not in ["PENDING", "ESCALATED"]:
|
||||
raise ValueError(f"Submission {submission_id} cannot be escalated")
|
||||
|
||||
submission.status = "ESCALATED"
|
||||
submission.handled_by = moderator
|
||||
submission.handled_at = timezone.now()
|
||||
|
||||
escalation_note = f"Escalated by {moderator.username}"
|
||||
if notes:
|
||||
escalation_note += f": {notes}"
|
||||
|
||||
if submission.notes:
|
||||
submission.notes += f"\n{escalation_note}"
|
||||
else:
|
||||
submission.notes = escalation_note
|
||||
|
||||
submission.full_clean()
|
||||
submission.save()
|
||||
|
||||
return submission
|
||||
|
||||
Reference in New Issue
Block a user