392 lines
27 KiB
Python
392 lines
27 KiB
Python
import sys
|
|
import os
|
|
import json
|
|
from datetime import datetime, timedelta
|
|
# Add parent directory to path to import from src
|
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
from sqlalchemy.orm import Session
|
|
from src.shared.config.database import SessionLocal
|
|
from src.content.models.page_content import PageContent, PageType
|
|
|
|
def seed_homepage_content(db: Session):
|
|
existing = db.query(PageContent).filter(PageContent.page_type == PageType.HOME).first()
|
|
luxury_features = [{'icon': 'Sparkles', 'title': 'Premium Amenities', 'description': 'World-class facilities designed for your comfort and relaxation'}, {'icon': 'Crown', 'title': 'Royal Service', 'description': 'Dedicated concierge service available 24/7 for all your needs'}, {'icon': 'Award', 'title': 'Award-Winning', 'description': 'Recognized for excellence in hospitality and guest satisfaction'}, {'icon': 'Shield', 'title': 'Secure & Private', 'description': 'Your privacy and security are our top priorities'}, {'icon': 'Heart', 'title': 'Personalized Care', 'description': 'Tailored experiences crafted just for you'}, {'icon': 'Gem', 'title': 'Luxury Design', 'description': 'Elegantly designed spaces with attention to every detail'}]
|
|
luxury_gallery = ['https://images.unsplash.com/photo-1566073771259-6a8506099945?w=800', 'https://images.unsplash.com/photo-1571896349842-33c89424de2d?w=800', 'https://images.unsplash.com/photo-1582719478250-c89cae4dc85b?w=800', 'https://images.unsplash.com/photo-1564501049412-61c2a3083791?w=800', 'https://images.unsplash.com/photo-1590490360182-c33d57733427?w=800', 'https://images.unsplash.com/photo-1551882547-ff40c63fe5fa?w=800']
|
|
luxury_testimonials = [{'name': 'Sarah Johnson', 'title': 'Business Executive', 'quote': 'An absolutely stunning experience. The attention to detail and level of service exceeded all expectations.', 'image': 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=200'}, {'name': 'Michael Chen', 'title': 'Travel Enthusiast', 'quote': 'The epitome of luxury. Every moment was perfect, from check-in to check-out.', 'image': 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=200'}, {'name': 'Emma Williams', 'title': 'Luxury Traveler', 'quote': 'This hotel redefines what luxury means. I will definitely return.', 'image': 'https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=200'}]
|
|
luxury_services = [
|
|
{
|
|
'icon': 'UtensilsCrossed',
|
|
'title': 'Fine Dining',
|
|
'description': 'Michelin-starred restaurants offering world-class cuisine',
|
|
'image': 'https://images.unsplash.com/photo-1517248135467-4c7edcad34c4?w=600',
|
|
'slug': 'fine-dining',
|
|
'category': 'Dining',
|
|
'content': '<p>Experience culinary excellence at our Michelin-starred restaurants. Our world-renowned chefs craft exquisite dishes using the finest ingredients sourced from around the globe. From intimate dining experiences to grand celebrations, we offer a variety of settings to suit every occasion.</p><p>Our restaurants feature seasonal menus that showcase the best of local and international cuisine, paired with an extensive wine collection curated by our master sommelier.</p>',
|
|
'sections': [],
|
|
'meta_title': 'Fine Dining Experience - Luxury Hotel',
|
|
'meta_description': 'Discover our Michelin-starred restaurants offering world-class cuisine in elegant settings.',
|
|
'meta_keywords': 'fine dining, michelin star, luxury restaurant, gourmet cuisine'
|
|
},
|
|
{
|
|
'icon': 'Wine',
|
|
'title': 'Premium Bar',
|
|
'description': 'Extensive wine collection and craft cocktails in elegant settings',
|
|
'image': 'https://images.unsplash.com/photo-1514362545857-3bc16c4c7d1b?w=600',
|
|
'slug': 'premium-bar',
|
|
'category': 'Dining',
|
|
'content': '<p>Unwind in sophistication at our premium bar, featuring an extensive collection of rare wines, vintage spirits, and expertly crafted cocktails. Our master mixologists create unique beverages tailored to your preferences.</p><p>The elegant ambiance, combined with live music on select evenings, creates the perfect setting for business meetings, romantic evenings, or casual gatherings with friends.</p>',
|
|
'sections': [],
|
|
'meta_title': 'Premium Bar & Lounge - Luxury Hotel',
|
|
'meta_description': 'Enjoy an extensive wine collection and craft cocktails in our elegant bar and lounge.',
|
|
'meta_keywords': 'premium bar, wine collection, craft cocktails, luxury lounge'
|
|
},
|
|
{
|
|
'icon': 'Dumbbell',
|
|
'title': 'Spa & Wellness',
|
|
'description': 'Rejuvenating spa treatments and state-of-the-art fitness center',
|
|
'image': 'https://images.unsplash.com/photo-1544161515-4ab6ce6db874?w=600',
|
|
'slug': 'spa-wellness',
|
|
'category': 'Wellness',
|
|
'content': '<p>Escape to tranquility at our world-class spa and wellness center. Indulge in a range of rejuvenating treatments designed to restore balance and vitality. Our expert therapists use premium products and ancient techniques to provide an unparalleled wellness experience.</p><p>Our state-of-the-art fitness center is equipped with the latest equipment and offers personal training sessions, yoga classes, and wellness programs tailored to your needs.</p>',
|
|
'sections': [],
|
|
'meta_title': 'Spa & Wellness Center - Luxury Hotel',
|
|
'meta_description': 'Rejuvenate with our spa treatments and state-of-the-art fitness facilities.',
|
|
'meta_keywords': 'spa, wellness, fitness center, massage, luxury spa'
|
|
},
|
|
{
|
|
'icon': 'Car',
|
|
'title': 'Concierge Services',
|
|
'description': 'Personalized assistance for all your travel and entertainment needs',
|
|
'image': 'https://images.unsplash.com/photo-1558618666-fcd25c85cd64?w=600',
|
|
'slug': 'concierge-services',
|
|
'category': 'Services',
|
|
'content': '<p>Our dedicated concierge team is available 24/7 to ensure your stay is nothing short of extraordinary. From restaurant reservations and event tickets to private tours and transportation arrangements, we handle every detail with precision and care.</p><p>Whether you need assistance with business arrangements, special celebrations, or unique local experiences, our concierge team has the expertise and connections to make it happen.</p>',
|
|
'sections': [],
|
|
'meta_title': 'Concierge Services - Luxury Hotel',
|
|
'meta_description': 'Personalized assistance for all your travel and entertainment needs, available 24/7.',
|
|
'meta_keywords': 'concierge, personal assistant, travel services, luxury service'
|
|
}
|
|
]
|
|
luxury_experiences = [{'icon': 'Sunset', 'title': 'Sunset Rooftop', 'description': 'Breathtaking views and exclusive rooftop experiences', 'image': 'https://images.unsplash.com/photo-1514933651103-005eec06c04b?w=600'}, {'icon': 'Ship', 'title': 'Yacht Excursions', 'description': 'Private yacht charters for unforgettable sea adventures', 'image': 'https://images.unsplash.com/photo-1544551763-46a013bb70d5?w=600'}, {'icon': 'Music', 'title': 'Live Entertainment', 'description': 'World-class performances and exclusive events', 'image': 'https://images.unsplash.com/photo-1470229722913-7c0e2dbbafd3?w=600'}, {'icon': 'Palette', 'title': 'Art & Culture', 'description': 'Curated art collections and cultural experiences', 'image': 'https://images.unsplash.com/photo-1578301978018-3005759f48f7?w=600'}]
|
|
awards = [{'icon': 'Trophy', 'title': 'Best Luxury Hotel 2024', 'description': 'Awarded by International Luxury Travel Association', 'image': 'https://images.unsplash.com/photo-1579783902614-a3fb3927b6a5?w=400', 'year': '2024'}, {'icon': 'Star', 'title': '5-Star Excellence', 'description': 'Consistently rated 5 stars by leading travel publications', 'image': 'https://images.unsplash.com/photo-1606761568499-6d2451b23c66?w=400', 'year': '2023'}, {'icon': 'Award', 'title': 'Sustainable Luxury', 'description': 'Recognized for environmental responsibility and sustainability', 'image': 'https://images.unsplash.com/photo-1473341304170-971dccb5ac1e?w=400', 'year': '2024'}]
|
|
partners = [{'name': 'Luxury Travel Group', 'logo': 'https://images.unsplash.com/photo-1599305445671-ac291c95aaa9?w=200', 'link': '#'}, {'name': 'Premium Airlines', 'logo': 'https://images.unsplash.com/photo-1436491865332-7a61a109cc05?w=200', 'link': '#'}, {'name': 'Exclusive Events', 'logo': 'https://images.unsplash.com/photo-1511578314322-379afb476865?w=200', 'link': '#'}, {'name': 'Fine Dining Network', 'logo': 'https://images.unsplash.com/photo-1555396273-367ea4eb4db5?w=200', 'link': '#'}]
|
|
stats = [{'icon': 'Users', 'number': '50,000+', 'label': 'Happy Guests'}, {'icon': 'Award', 'number': '25+', 'label': 'Awards Won'}, {'icon': 'Star', 'number': '4.9', 'label': 'Average Rating'}, {'icon': 'Globe', 'number': '100+', 'label': 'Countries Served'}]
|
|
amenities = [{'icon': 'Wifi', 'title': 'High-Speed WiFi', 'description': 'Complimentary high-speed internet throughout the property', 'image': ''}, {'icon': 'Coffee', 'title': '24/7 Room Service', 'description': 'Round-the-clock dining and beverage service', 'image': ''}, {'icon': 'Car', 'title': 'Valet Parking', 'description': 'Complimentary valet parking for all guests', 'image': ''}, {'icon': 'Plane', 'title': 'Airport Transfer', 'description': 'Luxury airport transfer service available', 'image': ''}]
|
|
features = [{'icon': 'Shield', 'title': 'Secure & Safe', 'description': '24/7 security and state-of-the-art safety systems'}, {'icon': 'Wifi', 'title': 'Free WiFi', 'description': 'High-speed internet access throughout the property'}, {'icon': 'Coffee', 'title': 'Room Service', 'description': '24/7 room service available for your convenience'}, {'icon': 'Car', 'title': 'Parking', 'description': 'Complimentary valet parking for all guests'}, {'icon': 'UtensilsCrossed', 'title': 'Fine Dining', 'description': 'World-class restaurants and dining experiences'}, {'icon': 'Dumbbell', 'title': 'Fitness Center', 'description': 'State-of-the-art fitness facilities'}]
|
|
testimonials = [{'name': 'Robert Martinez', 'role': 'CEO, Tech Corp', 'image': 'https://images.unsplash.com/photo-1500648767791-00dcc994a43e?w=200', 'rating': 5, 'comment': 'Exceptional service and attention to detail. The staff went above and beyond to make our stay memorable.'}, {'name': 'Lisa Anderson', 'role': 'Travel Blogger', 'image': 'https://images.unsplash.com/photo-1487412720507-e7ab37603c6f?w=200', 'rating': 5, 'comment': "The most luxurious hotel experience I've ever had. Every detail was perfect."}, {'name': 'David Thompson', 'role': 'Investment Banker', 'image': 'https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=200', 'rating': 5, 'comment': 'Outstanding facilities and impeccable service. Highly recommend for business travelers.'}]
|
|
gallery_images = ['https://images.unsplash.com/photo-1564501049412-61c2a3083791?w=800', 'https://images.unsplash.com/photo-1590490360182-c33d57733427?w=800', 'https://images.unsplash.com/photo-1551882547-ff40c63fe5fa?w=800', 'https://images.unsplash.com/photo-1571896349842-33c89424de2d?w=800', 'https://images.unsplash.com/photo-1582719478250-c89cae4dc85b?w=800', 'https://images.unsplash.com/photo-1566073771259-6a8506099945?w=800']
|
|
|
|
# Enterprise homepage fields
|
|
hero_video_url = 'https://videos.unsplash.com/video-1564501049412-61c2a3083791'
|
|
hero_video_poster = 'https://images.unsplash.com/photo-1564501049412-61c2a3083791?w=1200'
|
|
features_section_title = 'Why Choose Us'
|
|
features_section_subtitle = 'Discover what makes us the perfect choice for your stay'
|
|
stats_section_title = 'Our Achievements'
|
|
stats_section_subtitle = 'Numbers that speak for themselves'
|
|
rooms_section_title = 'Luxurious Rooms & Suites'
|
|
rooms_section_subtitle = 'Experience comfort and elegance in every room'
|
|
rooms_section_button_text = 'View All Rooms'
|
|
rooms_section_button_link = '/rooms'
|
|
rooms_section_enabled = True
|
|
services_section_button_text = 'Explore All Services'
|
|
services_section_button_link = '/services'
|
|
services_section_limit = 4
|
|
|
|
# Sections enabled configuration
|
|
sections_enabled = {
|
|
'features': True,
|
|
'luxury': True,
|
|
'gallery': True,
|
|
'testimonials': True,
|
|
'stats': True,
|
|
'amenities': True,
|
|
'about_preview': True,
|
|
'services': True,
|
|
'experiences': True,
|
|
'awards': True,
|
|
'cta': True,
|
|
'partners': True,
|
|
'rooms': True,
|
|
'newsletter': True,
|
|
'trust_badges': True,
|
|
'promotions': True,
|
|
'blog': True
|
|
}
|
|
|
|
# Newsletter section
|
|
newsletter_section_title = 'Stay Connected'
|
|
newsletter_section_subtitle = 'Subscribe to our newsletter for exclusive offers and updates'
|
|
newsletter_placeholder = 'Enter your email address'
|
|
newsletter_button_text = 'Subscribe'
|
|
newsletter_enabled = True
|
|
|
|
# Trust badges
|
|
trust_badges = [
|
|
{
|
|
'name': '5-Star Rating',
|
|
'logo': 'https://images.unsplash.com/photo-1579783902614-a3fb3927b6a5?w=200',
|
|
'description': 'Awarded 5 stars by leading travel organizations',
|
|
'link': '#'
|
|
},
|
|
{
|
|
'name': 'TripAdvisor Excellence',
|
|
'logo': 'https://images.unsplash.com/photo-1606761568499-6d2451b23c66?w=200',
|
|
'description': 'Certificate of Excellence winner',
|
|
'link': '#'
|
|
},
|
|
{
|
|
'name': 'Green Certified',
|
|
'logo': 'https://images.unsplash.com/photo-1473341304170-971dccb5ac1e?w=200',
|
|
'description': 'Eco-friendly and sustainable practices',
|
|
'link': '#'
|
|
},
|
|
{
|
|
'name': 'Luxury Collection',
|
|
'logo': 'https://images.unsplash.com/photo-1599305445671-ac291c95aaa9?w=200',
|
|
'description': 'Member of the world\'s finest luxury hotels',
|
|
'link': '#'
|
|
}
|
|
]
|
|
trust_badges_section_title = 'Trusted & Recognized'
|
|
trust_badges_section_subtitle = 'Awards and certifications that validate our commitment to excellence'
|
|
trust_badges_enabled = True
|
|
|
|
# Promotions - Mix of valid and expired for testing
|
|
# Calculate dates relative to current date
|
|
today = datetime.now()
|
|
next_month = today + timedelta(days=30)
|
|
next_3_months = today + timedelta(days=90)
|
|
next_6_months = today + timedelta(days=180)
|
|
expired_1_month_ago = today - timedelta(days=30)
|
|
expired_3_months_ago = today - timedelta(days=90)
|
|
|
|
promotions = [
|
|
{
|
|
'title': 'Early Bird Special',
|
|
'description': 'Book 30 days in advance and save 20% on your stay. Perfect for planning ahead!',
|
|
'image': 'https://images.unsplash.com/photo-1564501049412-61c2a3083791?w=600',
|
|
'discount': '20% OFF',
|
|
'valid_until': next_3_months.strftime('%Y-%m-%d'),
|
|
'link': '/rooms',
|
|
'button_text': 'Book Now',
|
|
'code': 'EARLYBIRD20'
|
|
},
|
|
{
|
|
'title': 'Weekend Getaway',
|
|
'description': 'Perfect weekend escape with complimentary breakfast and spa access. Relax and unwind!',
|
|
'image': 'https://images.unsplash.com/photo-1571896349842-33c89424de2d?w=600',
|
|
'discount': '30% OFF',
|
|
'valid_until': next_month.strftime('%Y-%m-%d'),
|
|
'link': '/rooms',
|
|
'button_text': 'View Offer',
|
|
'code': 'WEEKEND30'
|
|
},
|
|
{
|
|
'title': 'Luxury Suite Package',
|
|
'description': 'Experience our premium suites with exclusive amenities, fine dining, and concierge service',
|
|
'image': 'https://images.unsplash.com/photo-1582719478250-c89cae4dc85b?w=600',
|
|
'discount': 'Save $200',
|
|
'valid_until': next_6_months.strftime('%Y-%m-%d'),
|
|
'link': '/rooms',
|
|
'button_text': 'Explore Suites',
|
|
'code': 'LUXURY200'
|
|
},
|
|
{
|
|
'title': 'Honeymoon Special',
|
|
'description': 'Romantic getaway with champagne, flowers, special amenities, and complimentary room upgrade',
|
|
'image': 'https://images.unsplash.com/photo-1596394516093-501ba68a0ba6?w=600',
|
|
'discount': '25% OFF',
|
|
'valid_until': next_3_months.strftime('%Y-%m-%d'),
|
|
'link': '/rooms',
|
|
'button_text': 'Book Package',
|
|
'code': 'HONEYMOON25'
|
|
},
|
|
{
|
|
'title': 'Family Fun Package',
|
|
'description': 'Perfect for families! Includes family room, kids activities, and complimentary meals for children under 12',
|
|
'image': 'https://images.unsplash.com/photo-1566073771259-6a8506099945?w=600',
|
|
'discount': '15% OFF',
|
|
'valid_until': next_6_months.strftime('%Y-%m-%d'),
|
|
'link': '/rooms',
|
|
'button_text': 'Book Now',
|
|
'code': 'FAMILY15'
|
|
},
|
|
{
|
|
'title': 'Business Traveler',
|
|
'description': 'Extended stay discounts for business travelers. Includes high-speed WiFi, workspace, and airport transfer',
|
|
'image': 'https://images.unsplash.com/photo-1551882547-ff40c63fe5fa?w=600',
|
|
'discount': '10% OFF',
|
|
'valid_until': next_3_months.strftime('%Y-%m-%d'),
|
|
'link': '/rooms',
|
|
'button_text': 'Learn More',
|
|
'code': 'BUSINESS10'
|
|
},
|
|
# Expired promotions for testing display logic
|
|
{
|
|
'title': 'Summer Special',
|
|
'description': 'Enjoy 25% off on all room bookings this summer. Limited time offer!',
|
|
'image': 'https://images.unsplash.com/photo-1564501049412-61c2a3083791?w=600',
|
|
'discount': '25% OFF',
|
|
'valid_until': expired_3_months_ago.strftime('%Y-%m-%d'),
|
|
'link': '/rooms',
|
|
'button_text': 'Book Now',
|
|
'code': 'SUMMER25'
|
|
},
|
|
{
|
|
'title': 'New Year Celebration',
|
|
'description': 'Ring in the new year with our special celebration package. Includes party access and premium amenities',
|
|
'image': 'https://images.unsplash.com/photo-1590490360182-c33d57733427?w=600',
|
|
'discount': '35% OFF',
|
|
'valid_until': expired_1_month_ago.strftime('%Y-%m-%d'),
|
|
'link': '/rooms',
|
|
'button_text': 'View Offer',
|
|
'code': 'NEWYEAR35'
|
|
}
|
|
]
|
|
promotions_section_title = 'Special Offers'
|
|
promotions_section_subtitle = 'Exclusive deals and packages designed just for you'
|
|
promotions_enabled = True
|
|
|
|
# Blog section
|
|
blog_section_title = 'Latest News & Updates'
|
|
blog_section_subtitle = 'Stay informed about our latest news, events, and travel tips'
|
|
blog_posts_limit = 3
|
|
blog_enabled = True
|
|
|
|
homepage_data = {
|
|
'page_type': PageType.HOME,
|
|
'title': 'Luxury Hotel - Experience Unparalleled Elegance',
|
|
'subtitle': 'Where timeless luxury meets modern sophistication',
|
|
'description': 'Discover a world of refined elegance and exceptional service',
|
|
'hero_title': 'Welcome to Luxury',
|
|
'hero_subtitle': 'Experience the pinnacle of hospitality',
|
|
'hero_image': 'https://images.unsplash.com/photo-1564501049412-61c2a3083791?w=1200',
|
|
'hero_video_url': hero_video_url,
|
|
'hero_video_poster': hero_video_poster,
|
|
'features': json.dumps(features),
|
|
'features_section_title': features_section_title,
|
|
'features_section_subtitle': features_section_subtitle,
|
|
'luxury_section_title': 'Experience Unparalleled Luxury',
|
|
'luxury_section_subtitle': 'Where elegance meets comfort in every detail',
|
|
'luxury_section_image': 'https://images.unsplash.com/photo-1571896349842-33c89424de2d?w=1200',
|
|
'luxury_features': json.dumps(luxury_features),
|
|
'luxury_gallery_section_title': 'Our Luxury Gallery',
|
|
'luxury_gallery_section_subtitle': 'A glimpse into our world of elegance',
|
|
'luxury_gallery': json.dumps(luxury_gallery),
|
|
'luxury_testimonials_section_title': 'What Our Guests Say',
|
|
'luxury_testimonials_section_subtitle': 'Testimonials from our valued guests',
|
|
'luxury_testimonials': json.dumps(luxury_testimonials),
|
|
'luxury_services_section_title': 'Premium Services',
|
|
'luxury_services_section_subtitle': 'Indulge in our world-class amenities',
|
|
'luxury_services': json.dumps(luxury_services),
|
|
'services_section_button_text': services_section_button_text,
|
|
'services_section_button_link': services_section_button_link,
|
|
'services_section_limit': services_section_limit,
|
|
'luxury_experiences_section_title': 'Exclusive Experiences',
|
|
'luxury_experiences_section_subtitle': 'Create unforgettable memories',
|
|
'luxury_experiences': json.dumps(luxury_experiences),
|
|
'awards_section_title': 'Awards & Recognition',
|
|
'awards_section_subtitle': 'Recognized for excellence worldwide',
|
|
'awards': json.dumps(awards),
|
|
'partners_section_title': 'Our Partners',
|
|
'partners_section_subtitle': 'Trusted by leading brands',
|
|
'partners': json.dumps(partners),
|
|
'amenities_section_title': 'Premium Amenities',
|
|
'amenities_section_subtitle': 'Everything you need for a perfect stay',
|
|
'amenities': json.dumps(amenities),
|
|
'testimonials_section_title': 'Guest Reviews',
|
|
'testimonials_section_subtitle': 'Hear from our satisfied guests',
|
|
'testimonials': json.dumps(testimonials),
|
|
'gallery_section_title': 'Photo Gallery',
|
|
'gallery_section_subtitle': 'Explore our beautiful spaces',
|
|
'gallery_images': json.dumps(gallery_images),
|
|
'about_preview_title': 'About Our Luxury Hotel',
|
|
'about_preview_subtitle': 'A legacy of excellence',
|
|
'about_preview_content': 'Discover a world of refined elegance and exceptional service. Our hotel combines timeless luxury with modern amenities to create an unforgettable experience. With over 50,000 satisfied guests and numerous awards, we continue to set the standard for luxury hospitality.',
|
|
'about_preview_image': 'https://images.unsplash.com/photo-1582719478250-c89cae4dc85b?w=800',
|
|
'stats': json.dumps(stats),
|
|
'stats_section_title': stats_section_title,
|
|
'stats_section_subtitle': stats_section_subtitle,
|
|
'rooms_section_title': rooms_section_title,
|
|
'rooms_section_subtitle': rooms_section_subtitle,
|
|
'rooms_section_button_text': rooms_section_button_text,
|
|
'rooms_section_button_link': rooms_section_button_link,
|
|
'rooms_section_enabled': rooms_section_enabled,
|
|
'sections_enabled': json.dumps(sections_enabled),
|
|
'newsletter_section_title': newsletter_section_title,
|
|
'newsletter_section_subtitle': newsletter_section_subtitle,
|
|
'newsletter_placeholder': newsletter_placeholder,
|
|
'newsletter_button_text': newsletter_button_text,
|
|
'newsletter_enabled': newsletter_enabled,
|
|
'trust_badges_section_title': trust_badges_section_title,
|
|
'trust_badges_section_subtitle': trust_badges_section_subtitle,
|
|
'trust_badges': json.dumps(trust_badges),
|
|
'trust_badges_enabled': trust_badges_enabled,
|
|
'promotions_section_title': promotions_section_title,
|
|
'promotions_section_subtitle': promotions_section_subtitle,
|
|
'promotions': json.dumps(promotions),
|
|
'promotions_enabled': promotions_enabled,
|
|
'blog_section_title': blog_section_title,
|
|
'blog_section_subtitle': blog_section_subtitle,
|
|
'blog_posts_limit': blog_posts_limit,
|
|
'blog_enabled': blog_enabled,
|
|
'cta_title': 'Ready to Experience Luxury?',
|
|
'cta_subtitle': 'Book your stay today and discover the difference',
|
|
'cta_button_text': 'Book Now',
|
|
'cta_button_link': '/rooms',
|
|
'cta_image': 'https://images.unsplash.com/photo-1566073771259-6a8506099945?w=1200',
|
|
'is_active': True
|
|
}
|
|
if existing:
|
|
for key, value in homepage_data.items():
|
|
if key != 'page_type':
|
|
setattr(existing, key, value)
|
|
print('✓ Updated existing homepage content')
|
|
else:
|
|
new_content = PageContent(**homepage_data)
|
|
db.add(new_content)
|
|
print('✓ Created new homepage content')
|
|
db.commit()
|
|
|
|
def seed_footer_content(db: Session):
|
|
existing = db.query(PageContent).filter(PageContent.page_type == PageType.FOOTER).first()
|
|
contact_info = {'phone': '+1 (555) 123-4567', 'email': 'info@luxuryhotel.com', 'address': '123 Luxury Avenue, Premium District, City 12345'}
|
|
social_links = {'facebook': 'https://facebook.com/luxuryhotel', 'twitter': 'https://twitter.com/luxuryhotel', 'instagram': 'https://instagram.com/luxuryhotel', 'linkedin': 'https://linkedin.com/company/luxuryhotel', 'youtube': 'https://youtube.com/luxuryhotel'}
|
|
footer_links = {'quick_links': [{'label': 'Home', 'url': '/'}, {'label': 'Rooms & Suites', 'url': '/rooms'}, {'label': 'About Us', 'url': '/about'}, {'label': 'Contact', 'url': '/contact'}, {'label': 'Gallery', 'url': '/gallery'}], 'support_links': [{'label': 'FAQ', 'url': '/faq'}, {'label': 'Privacy Policy', 'url': '/privacy'}, {'label': 'Terms of Service', 'url': '/terms'}, {'label': 'Cancellation Policy', 'url': '/cancellation'}, {'label': 'Accessibility', 'url': '/accessibility'}]}
|
|
badges = [{'text': '5-Star Rated', 'icon': 'Star'}, {'text': 'Award Winning', 'icon': 'Award'}, {'text': 'Eco Certified', 'icon': 'Leaf'}, {'text': 'Luxury Collection', 'icon': 'Crown'}]
|
|
footer_data = {'page_type': PageType.FOOTER, 'title': 'Luxury Hotel', 'subtitle': 'Experience Unparalleled Elegance', 'description': 'Your gateway to luxury hospitality and exceptional service', 'contact_info': json.dumps(contact_info), 'social_links': json.dumps(social_links), 'footer_links': json.dumps(footer_links), 'badges': json.dumps(badges), 'copyright_text': '© {YEAR} Luxury Hotel. All rights reserved.', 'is_active': True}
|
|
if existing:
|
|
for key, value in footer_data.items():
|
|
if key != 'page_type':
|
|
setattr(existing, key, value)
|
|
print('✓ Updated existing footer content')
|
|
else:
|
|
new_content = PageContent(**footer_data)
|
|
db.add(new_content)
|
|
print('✓ Created new footer content')
|
|
db.commit()
|
|
|
|
def main():
|
|
db: Session = SessionLocal()
|
|
try:
|
|
print('=' * 80)
|
|
print('SEEDING HOMEPAGE AND FOOTER CONTENT')
|
|
print('=' * 80)
|
|
print()
|
|
print('Seeding homepage content...')
|
|
seed_homepage_content(db)
|
|
print('\nSeeding footer content...')
|
|
seed_footer_content(db)
|
|
print('\n' + '=' * 80)
|
|
print('✓ All content seeded successfully!')
|
|
print('=' * 80)
|
|
except Exception as e:
|
|
db.rollback()
|
|
print(f'\n✗ Error seeding content: {e}')
|
|
import traceback
|
|
traceback.print_exc()
|
|
raise
|
|
finally:
|
|
db.close()
|
|
if __name__ == '__main__':
|
|
main() |