mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 14:11:09 -05:00
Update migration files for Django 5.1.4; remove obsolete merge migrations and adjust history tracking context in templates
This commit is contained in:
101
scripts/create_initial_data.py
Normal file
101
scripts/create_initial_data.py
Normal file
@@ -0,0 +1,101 @@
|
||||
from django.utils import timezone
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.contrib.gis.geos import Point
|
||||
from parks.models import Park
|
||||
from rides.models import Ride, RideModel, RollerCoasterStats
|
||||
from companies.models import Manufacturer
|
||||
from location.models import Location
|
||||
|
||||
# Create Cedar Point
|
||||
park, _ = Park.objects.get_or_create(
|
||||
name="Cedar Point",
|
||||
slug="cedar-point",
|
||||
defaults={
|
||||
"description": "Cedar Point is a 364-acre amusement park located on a Lake Erie peninsula in Sandusky, Ohio.",
|
||||
"website": "https://www.cedarpoint.com",
|
||||
"size_acres": 364,
|
||||
"opening_date": timezone.datetime(1870, 1, 1).date(), # Cedar Point opened in 1870
|
||||
}
|
||||
)
|
||||
|
||||
# Create location for Cedar Point
|
||||
Location.objects.get_or_create(
|
||||
content_type=ContentType.objects.get_for_model(Park),
|
||||
object_id=park.id,
|
||||
defaults={
|
||||
"name": "Cedar Point",
|
||||
"location_type": "amusement_park",
|
||||
"street_address": "1 Cedar Point Dr",
|
||||
"city": "Sandusky",
|
||||
"state": "OH",
|
||||
"postal_code": "44870",
|
||||
"country": "USA",
|
||||
"latitude": 41.4822,
|
||||
"longitude": -82.6839,
|
||||
"point": Point(-82.6839, 41.4822) # longitude, latitude
|
||||
}
|
||||
)
|
||||
|
||||
# Create Intamin as manufacturer
|
||||
bm, _ = Manufacturer.objects.get_or_create(
|
||||
name="Intamin",
|
||||
slug="intamin",
|
||||
defaults={
|
||||
"description": "Intamin Amusement Rides is a design company known for creating some of the most thrilling and innovative roller coasters in the world.",
|
||||
"website": "https://www.intaminworldwide.com"
|
||||
}
|
||||
)
|
||||
|
||||
# Create Giga Coaster model
|
||||
giga_model, _ = RideModel.objects.get_or_create(
|
||||
name="Giga Coaster",
|
||||
manufacturer=bm,
|
||||
defaults={
|
||||
"description": "A roller coaster type characterized by a height between 300–399 feet and a complete circuit.",
|
||||
"category": "RC" # Roller Coaster
|
||||
}
|
||||
)
|
||||
|
||||
# Create Millennium Force
|
||||
millennium, _ = Ride.objects.get_or_create(
|
||||
name="Millennium Force",
|
||||
slug="millennium-force",
|
||||
defaults={
|
||||
"description": (
|
||||
"Millennium Force is a steel roller coaster located at Cedar Point amusement park in Sandusky, Ohio. "
|
||||
"It was built by Intamin of Switzerland and opened on May 13, 2000 as the world's first giga coaster, "
|
||||
"a class of roller coasters having a height between 300 and 399 feet and a complete circuit."
|
||||
),
|
||||
"park": park,
|
||||
"category": "RC",
|
||||
"manufacturer": bm,
|
||||
"ride_model": giga_model,
|
||||
"status": "OPERATING",
|
||||
"opening_date": timezone.datetime(2000, 5, 13).date(),
|
||||
"min_height_in": 48, # 48 inches minimum height
|
||||
"capacity_per_hour": 1300,
|
||||
"ride_duration_seconds": 120 # 2 minutes
|
||||
}
|
||||
)
|
||||
|
||||
# Create stats for Millennium Force
|
||||
RollerCoasterStats.objects.get_or_create(
|
||||
ride=millennium,
|
||||
defaults={
|
||||
"height_ft": 310,
|
||||
"length_ft": 6595,
|
||||
"speed_mph": 93,
|
||||
"inversions": 0,
|
||||
"ride_time_seconds": 120,
|
||||
"track_material": "STEEL",
|
||||
"roller_coaster_type": "SITDOWN",
|
||||
"max_drop_height_ft": 300,
|
||||
"launch_type": "CHAIN",
|
||||
"train_style": "Open-air stadium seating",
|
||||
"trains_count": 3,
|
||||
"cars_per_train": 9,
|
||||
"seats_per_car": 4
|
||||
}
|
||||
)
|
||||
|
||||
print("Initial data created successfully!")
|
||||
Reference in New Issue
Block a user