mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-27 12:07:04 -05:00
feat: Add blog, media, and support apps, implement ride credits and image API, and remove toplist feature.
This commit is contained in:
@@ -24,7 +24,7 @@ from django.utils.text import slugify
|
||||
|
||||
# Import all models
|
||||
from apps.accounts.models import (
|
||||
User, UserProfile, TopList, TopListItem, UserNotification,
|
||||
User, UserProfile, UserNotification,
|
||||
NotificationPreference, UserDeletionRequest
|
||||
)
|
||||
from apps.parks.models import (
|
||||
@@ -128,7 +128,7 @@ class Command(BaseCommand):
|
||||
|
||||
# Create content and interactions
|
||||
self.create_reviews(options['reviews'], users, parks, rides)
|
||||
self.create_top_lists(users, parks, rides)
|
||||
|
||||
self.create_notifications(users)
|
||||
self.create_moderation_data(users, parks, rides)
|
||||
|
||||
@@ -149,7 +149,7 @@ class Command(BaseCommand):
|
||||
|
||||
models_to_clear = [
|
||||
# Content and interactions (clear first)
|
||||
TopListItem, TopList, UserNotification, NotificationPreference,
|
||||
UserNotification, NotificationPreference,
|
||||
ParkReview, RideReview, ModerationAction, ModerationQueue,
|
||||
|
||||
# Media
|
||||
@@ -1042,65 +1042,7 @@ class Command(BaseCommand):
|
||||
|
||||
self.stdout.write(f' ✅ Created {count} reviews')
|
||||
|
||||
def create_top_lists(self, users: List[User], parks: List[Park], rides: List[Ride]) -> None:
|
||||
"""Create user top lists"""
|
||||
self.stdout.write('📋 Creating top lists...')
|
||||
|
||||
if not users:
|
||||
self.stdout.write(' ⚠️ No users found, skipping top lists')
|
||||
return
|
||||
|
||||
list_count = 0
|
||||
|
||||
# Create top lists for some users
|
||||
for user in random.sample(users, min(len(users), 10)):
|
||||
# Create roller coaster top list
|
||||
if rides:
|
||||
coasters = [r for r in rides if r.category == 'RC']
|
||||
if coasters:
|
||||
top_list = TopList.objects.create(
|
||||
user=user,
|
||||
title=f"{user.get_display_name()}'s Top Roller Coasters",
|
||||
category="RC",
|
||||
description="My favorite roller coasters ranked by thrill and experience",
|
||||
)
|
||||
|
||||
# Add items to the list
|
||||
for rank, coaster in enumerate(random.sample(coasters, min(len(coasters), 10)), 1):
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
content_type = ContentType.objects.get_for_model(coaster)
|
||||
TopListItem.objects.create(
|
||||
top_list=top_list,
|
||||
content_type=content_type,
|
||||
object_id=coaster.pk,
|
||||
rank=rank,
|
||||
notes=f"Incredible {coaster.category} experience at {coaster.park.name}",
|
||||
)
|
||||
list_count += 1
|
||||
|
||||
# Create park top list
|
||||
if parks and random.random() < 0.5:
|
||||
top_list = TopList.objects.create(
|
||||
user=user,
|
||||
title=f"{user.get_display_name()}'s Favorite Parks",
|
||||
category="PK",
|
||||
description="Theme parks that provide the best overall experience",
|
||||
)
|
||||
|
||||
# Add items to the list
|
||||
for rank, park in enumerate(random.sample(parks, min(len(parks), 5)), 1):
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
content_type = ContentType.objects.get_for_model(park)
|
||||
TopListItem.objects.create(
|
||||
top_list=top_list,
|
||||
content_type=content_type,
|
||||
object_id=park.pk,
|
||||
rank=rank,
|
||||
notes=f"Amazing park with great {park.park_type.lower().replace('_', ' ')} atmosphere",
|
||||
)
|
||||
list_count += 1
|
||||
|
||||
self.stdout.write(f' ✅ Created {list_count} top lists')
|
||||
|
||||
|
||||
def create_notifications(self, users: List[User]) -> None:
|
||||
"""Create sample notifications for users"""
|
||||
@@ -1198,7 +1140,7 @@ class Command(BaseCommand):
|
||||
'Ride Models': RideModel.objects.count(),
|
||||
'Park Reviews': ParkReview.objects.count(),
|
||||
'Ride Reviews': RideReview.objects.count(),
|
||||
'Top Lists': TopList.objects.count(),
|
||||
|
||||
'Notifications': UserNotification.objects.count(),
|
||||
'Park Photos': ParkPhoto.objects.count(),
|
||||
'Ride Photos': RidePhoto.objects.count(),
|
||||
|
||||
Reference in New Issue
Block a user