import os
from django.core.management.base import BaseCommand
from django.core.files.base import ContentFile
from django.utils.text import slugify
import requests
from io import BytesIO
from django.conf import settings

# Import your models here - adjust the import path as needed
from colleges.models import (
    College, HeroSection, Badge, AboutSection, AboutContent,
    DirectorSection, ProgramsSection, Program, WhyChooseSection,
    Feature, FacultySection, Faculty, TestimonialSection, Testimonial,
    RecruitersSection, Recruiter, InfrastructureSection, Facility
)

class Command(BaseCommand):
    help = 'Import demonstration data for colleges'

    def handle(self, *args, **options):
        self.stdout.write(self.style.SUCCESS('Starting import of college demonstration data'))
        
        # Create media directory if it doesn't exist
        os.makedirs(os.path.join(settings.MEDIA_ROOT, 'college_images/hero'), exist_ok=True)
        os.makedirs(os.path.join(settings.MEDIA_ROOT, 'college_images/about'), exist_ok=True)
        os.makedirs(os.path.join(settings.MEDIA_ROOT, 'college_images/directors'), exist_ok=True)
        os.makedirs(os.path.join(settings.MEDIA_ROOT, 'college_images/why_choose'), exist_ok=True)
        os.makedirs(os.path.join(settings.MEDIA_ROOT, 'college_images/faculty'), exist_ok=True)
        os.makedirs(os.path.join(settings.MEDIA_ROOT, 'college_images/testimonials'), exist_ok=True)
        os.makedirs(os.path.join(settings.MEDIA_ROOT, 'college_images/recruiters'), exist_ok=True)
        os.makedirs(os.path.join(settings.MEDIA_ROOT, 'college_images/facilities'), exist_ok=True)
        
        # Sample data for colleges
        colleges_data = [
            {
                'name': 'Roorkee College of Engineering',
                'short_description': 'A premier engineering institution focused on excellence in technical education.',
                'hero': {
                    'title': 'Roorkee College of Engineering',
                    'subtitle': 'Shaping the future of engineering education with cutting-edge programs and world-class facilities.',
                    'background_image': 'https://source.unsplash.com/random/1200x600/?engineering',
                    'admission_info': 'Admissions Open for 2023-24',
                    'badges': ['NAAC A+ Accredited', 'AICTE Approved', 'UGC Recognized']
                },
                'about': {
                    'title': 'About Roorkee College of Engineering',
                    'image': 'https://source.unsplash.com/random/800x600/?college',
                    'content': [
                        'Established in 1998, Roorkee College of Engineering (RCE) has been at the forefront of technical education in India. Our mission is to provide quality education that prepares students for the challenges of the modern technological landscape.',
                        'With state-of-the-art laboratories, experienced faculty, and industry connections, we ensure that our students receive both theoretical knowledge and practical skills necessary for success in their careers.',
                        'RCE is known for its innovative teaching methodologies, research opportunities, and placement record. We take pride in our alumni who have made significant contributions to various industries globally.'
                    ]
                },
                'director': {
                    'name': 'Dr. Rajesh Kumar',
                    'title': 'Director, Roorkee College of Engineering',
                    'message': 'Welcome to Roorkee College of Engineering, where we are committed to academic excellence and holistic development of our students. Our goal is to nurture not just engineers, but leaders who can make a positive impact on society through technological innovation and ethical practices. We invite you to join our community of learners and become part of our legacy of excellence.',
                    'image': 'https://source.unsplash.com/random/400x500/?professor'
                },
                'programs': {
                    'title': 'Our Programs',
                    'description': 'We offer a wide range of undergraduate and postgraduate programs designed to meet the evolving needs of the industry.',
                    'has_doctoral_programs': True,
                    'programs_list': [
                        {'name': 'B.Tech in Computer Science & Engineering', 'link': '/academics/programs/courses/btech-computer-science-engineering', 'program_type': 'UG'},
                        {'name': 'B.Tech in Electronics & Communication Engineering', 'link': '/academics/programs/courses/btech-electronics-communication-engineering', 'program_type': 'UG'},
                        {'name': 'B.Tech in Mechanical Engineering', 'link': '/academics/programs/courses/btech-mechanical-engineering', 'program_type': 'UG'},
                        {'name': 'B.Tech in Civil Engineering', 'link': '/academics/programs/courses/btech-civil-engineering', 'program_type': 'UG'},
                        {'name': 'M.Tech in Computer Science & Engineering', 'link': '/academics/programs/courses/mtech-computer-science-engineering', 'program_type': 'PG'},
                        {'name': 'M.Tech in Electronics & Communication Engineering', 'link': '/academics/programs/courses/mtech-electronics-communication-engineering', 'program_type': 'PG'},
                        {'name': 'Diploma in Mechanical Engineering', 'link': '/academics/programs/courses/diploma-mechanical-engineering', 'program_type': 'DP'}
                    ]
                },
                'why_choose': {
                    'title': 'Why Choose RCE?',
                    'description': 'Roorkee College of Engineering offers a unique learning experience that prepares students for successful careers in engineering and technology.',
                    'conclusion': 'Join us to be part of a vibrant academic community that values innovation, excellence, and ethical engineering practices.',
                    'image': 'https://source.unsplash.com/random/800x600/?campus',
                    'features': [
                        'State-of-the-art laboratories and workshops',
                        'Experienced faculty with industry background',
                        'Strong industry connections and placement support',
                        'Research opportunities and innovation centers',
                        'Modern infrastructure and digital learning resources',
                        'Active student clubs and technical societies'
                    ]
                },
                'faculty': {
                    'title': 'Our Distinguished Faculty',
                    'description': 'Learn from the best minds in engineering education. Our faculty members bring a wealth of academic and industry experience.',
                    'members': [
                        {
                            'name': 'Dr. Anand Sharma',
                            'position': 'Professor & Head',
                            'department': 'Computer Science & Engineering',
                            'qualifications': 'Ph.D. (IIT Delhi), M.Tech (IIT Bombay)',
                            'image': 'https://source.unsplash.com/random/300x300/?professor'
                        },
                        {
                            'name': 'Dr. Priya Gupta',
                            'position': 'Associate Professor',
                            'department': 'Electronics & Communication Engineering',
                            'qualifications': 'Ph.D. (IIT Kanpur), M.Tech (NIT Warangal)',
                            'image': 'https://source.unsplash.com/random/300x300/?woman,professor'
                        },
                        {
                            'name': 'Dr. Sunil Mehta',
                            'position': 'Professor',
                            'department': 'Mechanical Engineering',
                            'qualifications': 'Ph.D. (IIT Roorkee), M.Tech (IIT Madras)',
                            'image': 'https://source.unsplash.com/random/300x300/?indian,man'
                        }
                    ]
                },
                'testimonials': {
                    'title': 'What Our Students Say',
                    'testimonials_list': [
                        {
                            'name': 'Rahul Sharma',
                            'course': 'B.Tech CSE, Batch of 2022',
                            'company': 'Microsoft',
                            'testimonial': 'My time at RCE was transformative. The practical approach to learning and supportive faculty helped me secure my dream job at Microsoft.',
                            'image': 'https://source.unsplash.com/random/300x300/?indian,student'
                        },
                        {
                            'name': 'Priya Singh',
                            'course': 'B.Tech ECE, Batch of 2021',
                            'company': 'Intel',
                            'testimonial': "The hands-on experience I gained at RCE's well-equipped labs gave me an edge during my interviews. The placement cell provided excellent support throughout the process.",
                            'image': 'https://source.unsplash.com/random/300x300/?indian,woman'
                        },
                        {
                            'name': 'Amit Patel',
                            'course': 'M.Tech CSE, Batch of 2022',
                            'company': 'Amazon',
                            'testimonial': 'The research opportunities and industry projects at RCE prepared me well for my role at Amazon. The faculty mentorship was invaluable for my growth.',
                            'image': 'https://source.unsplash.com/random/300x300/?indian,graduate'
                        }
                    ]
                },
                'recruiters': {
                    'title': 'Our Top Recruiters',
                    'recruiters_list': [
                        {'name': 'Microsoft', 'logo': 'https://logo.clearbit.com/microsoft.com'},
                        {'name': 'Google', 'logo': 'https://logo.clearbit.com/google.com'},
                        {'name': 'Amazon', 'logo': 'https://logo.clearbit.com/amazon.com'},
                        {'name': 'Infosys', 'logo': 'https://logo.clearbit.com/infosys.com'},
                        {'name': 'TCS', 'logo': 'https://logo.clearbit.com/tcs.com'},
                        {'name': 'Wipro', 'logo': 'https://logo.clearbit.com/wipro.com'},
                        {'name': 'IBM', 'logo': 'https://logo.clearbit.com/ibm.com'},
                        {'name': 'Accenture', 'logo': 'https://logo.clearbit.com/accenture.com'}
                    ]
                },
                'infrastructure': {
                    'title': 'Our Infrastructure',
                    'description': 'We provide world-class infrastructure to support learning, research, and innovation.',
                    'facilities': [
                        {
                            'title': 'Advanced Computing Labs',
                            'description': 'Our computing labs are equipped with the latest hardware and software to support cutting-edge research and learning.',
                            'image': 'https://source.unsplash.com/random/800x600/?computer,lab'
                        },
                        {
                            'title': 'Electronics Labs',
                            'description': 'State-of-the-art electronics labs with modern equipment for practical learning and experimentation.',
                            'image': 'https://source.unsplash.com/random/800x600/?electronics,lab'
                        },
                        {
                            'title': 'Central Library',
                            'description': 'A vast collection of books, journals, and digital resources to support academic and research activities.',
                            'image': 'https://source.unsplash.com/random/800x600/?library'
                        },
                        {
                            'title': 'Sports Complex',
                            'description': 'Comprehensive sports facilities including indoor and outdoor games to promote physical fitness and team spirit.',
                            'image': 'https://source.unsplash.com/random/800x600/?sports,complex'
                        }
                    ]
                }
            },
            {
                'name': 'School of Management Studies',
                'short_description': 'Developing future business leaders through innovative management education.',
                'hero': {
                    'title': 'School of Management Studies',
                    'subtitle': 'Transforming students into business leaders through innovative management education and industry exposure.',
                    'background_image': 'https://source.unsplash.com/random/1200x600/?business',
                    'admission_info': 'MBA Admissions Open for 2023-24',
                    'badges': ['NAAC A+ Accredited', 'AICTE Approved', 'NBA Accredited']
                },
                'about': {
                    'title': 'About School of Management Studies',
                    'image': 'https://source.unsplash.com/random/800x600/?business,school',
                    'content': [
                        'Established in 2005, the School of Management Studies (SMS) is dedicated to providing quality management education that prepares students for leadership roles in the global business environment.',
                        'Our curriculum is designed to blend theoretical knowledge with practical applications, ensuring that our graduates are ready to tackle real-world business challenges.',
                        'With a focus on experiential learning, industry partnerships, and global exposure, SMS offers a transformative educational experience that shapes future business leaders.'
                    ]
                },
                'director': {
                    'name': 'Dr. Sunita Patel',
                    'title': 'Director, School of Management Studies',
                    'message': 'Welcome to the School of Management Studies, where we are committed to developing business leaders with a global perspective and ethical foundation. Our innovative curriculum, experienced faculty, and industry connections provide students with the knowledge and skills needed to excel in today\'s dynamic business environment. Join us to transform your potential into performance and prepare for a successful career in management.',
                    'image': 'https://source.unsplash.com/random/400x500/?businesswoman'
                },
                'programs': {
                    'title': 'Our Programs',
                    'description': 'We offer comprehensive management programs designed to prepare students for leadership roles in various business domains.',
                    'has_doctoral_programs': True,
                    'programs_list': [
                        {'name': 'MBA (Master of Business Administration)', 'link': '/academics/programs/courses/mba', 'program_type': 'PG'},
                        {'name': 'MBA in Finance', 'link': '/academics/programs/courses/mba-finance', 'program_type': 'PG'},
                        {'name': 'MBA in Marketing', 'link': '/academics/programs/courses/mba-marketing', 'program_type': 'PG'},
                        {'name': 'MBA in Human Resource Management', 'link': '/academics/programs/courses/mba-hrm', 'program_type': 'PG'},
                        {'name': 'BBA (Bachelor of Business Administration)', 'link': '/academics/programs/courses/bba', 'program_type': 'UG'},
                        {'name': 'Ph.D. in Management', 'link': '/academics/programs/courses/phd-management', 'program_type': 'PG'}
                    ]
                },
                'why_choose': {
                    'title': 'Why Choose SMS?',
                    'description': 'The School of Management Studies offers a unique learning experience that prepares students for successful careers in the business world.',
                    'conclusion': 'Join us to develop the skills, knowledge, and network needed to thrive in the global business environment.',
                    'image': 'https://source.unsplash.com/random/800x600/?business,meeting',
                    'features': [
                        'Industry-aligned curriculum',
                        'Experienced faculty with corporate background',
                        'Strong industry connections and placement support',
                        'International exchange programs',
                        'Case-based learning approach',
                        'Active entrepreneurship cell',
                        'Regular industry visits and guest lectures'
                    ]
                },
                'faculty': {
                    'title': 'Our Distinguished Faculty',
                    'description': 'Learn from experienced academicians and industry professionals who bring real-world insights into the classroom.',
                    'members': [
                        {
                            'name': 'Dr. Rajiv Khanna',
                            'position': 'Professor & Head',
                            'department': 'Finance',
                            'qualifications': 'Ph.D. (IIM Ahmedabad), MBA (FMS Delhi)',
                            'image': 'https://source.unsplash.com/random/300x300/?businessman'
                        },
                        {
                            'name': 'Dr. Meera Iyer',
                            'position': 'Associate Professor',
                            'department': 'Marketing',
                            'qualifications': 'Ph.D. (IIM Bangalore), MBA (XLRI)',
                            'image': 'https://source.unsplash.com/random/300x300/?indian,businesswoman'
                        },
                        {
                            'name': 'Prof. Anil Gupta',
                            'position': 'Assistant Professor',
                            'department': 'Human Resource Management',
                            'qualifications': 'MBA (IIM Lucknow), Ph.D. (pursuing)',
                            'image': 'https://source.unsplash.com/random/300x300/?professor,indian'
                        }
                    ]
                },
                'testimonials': {
                    'title': 'What Our Students Say',
                    'testimonials_list': [
                        {
                            'name': 'Neha Sharma',
                            'course': 'MBA, Batch of 2022',
                            'company': 'Deloitte',
                            'testimonial': 'The practical approach to management education at SMS prepared me well for my consulting role. The case studies, simulations, and industry projects were particularly valuable.',
                            'image': 'https://source.unsplash.com/random/300x300/?indian,businesswoman'
                        },
                        {
                            'name': 'Vikram Malhotra',
                            'course': 'MBA Finance, Batch of 2021',
                            'company': 'HDFC Bank',
                            'testimonial': 'The specialized finance curriculum and mentorship from industry experts helped me secure a role in investment banking. The placement support was excellent throughout.',
                            'image': 'https://source.unsplash.com/random/300x300/?indian,businessman'
                        },
                        {
                            'name': 'Anjali Desai',
                            'course': 'BBA, Batch of 2022',
                            'company': 'Startup Founder',
                            'testimonial': 'The entrepreneurship cell and startup incubation support at SMS gave me the confidence to launch my own venture right after graduation. The network I built during my time here has been invaluable.',
                            'image': 'https://source.unsplash.com/random/300x300/?indian,entrepreneur'
                        }
                    ]
                },
                'recruiters': {
                    'title': 'Our Top Recruiters',
                    'recruiters_list': [
                        {'name': 'Deloitte', 'logo': 'https://logo.clearbit.com/deloitte.com'},
                        {'name': 'KPMG', 'logo': 'https://logo.clearbit.com/kpmg.com'},
                        {'name': 'HDFC Bank', 'logo': 'https://logo.clearbit.com/hdfcbank.com'},
                        {'name': 'Axis Bank', 'logo': 'https://logo.clearbit.com/axisbank.com'},
                        {'name': 'Hindustan Unilever', 'logo': 'https://logo.clearbit.com/hul.co.in'},
                        {'name': 'ITC', 'logo': 'https://logo.clearbit.com/itcportal.com'},
                        {'name': 'Reliance Industries', 'logo': 'https://logo.clearbit.com/ril.com'},
                        {'name': 'Tata Consultancy Services', 'logo': 'https://logo.clearbit.com/tcs.com'}
                    ]
                },
                'infrastructure': {
                    'title': 'Our Infrastructure',
                    'description': 'We provide modern facilities to support learning, research, and professional development.',
                    'facilities': [
                        {
                            'title': 'Bloomberg Finance Lab',
                            'description': 'A state-of-the-art finance lab with Bloomberg terminals for real-time market analysis and financial research.',
                            'image': 'https://source.unsplash.com/random/800x600/?finance,lab'
                        },
                        {
                            'title': 'Marketing Research Center',
                            'description': 'Equipped with advanced tools for market research, consumer behavior analysis, and marketing strategy development.',
                            'image': 'https://source.unsplash.com/random/800x600/?marketing,research'
                        },
                        {
                            'title': 'Conference Hall',
                            'description': 'Modern conference facilities for seminars, workshops, and corporate events.',
                            'image': 'https://source.unsplash.com/random/800x600/?conference,hall'
                        },
                        {
                            'title': 'Startup Incubation Center',
                            'description': 'A dedicated space for student entrepreneurs to develop and launch their business ideas with mentorship and resources.',
                            'image': 'https://source.unsplash.com/random/800x600/?startup,incubator'
                        }
                    ]
                }
            }
        ]
        
        # Function to download and save image
        def save_image_from_url(url, field_name):
            try:
                response = requests.get(url)
                if response.status_code == 200:
                    # Extract filename from URL
                    filename = os.path.basename(url.split('?')[0])
                    if not filename or '.' not in filename:
                        filename = f"{field_name}.jpg"
                    
                    # Create ContentFile from response content
                    image_content = ContentFile(response.content, name=filename)
                    return image_content
                else:
                    self.stdout.write(self.style.WARNING(f"Failed to download image from {url}"))
                    return None
            except Exception as e:
                self.stdout.write(self.style.ERROR(f"Error downloading image: {str(e)}"))
                return None
        
        # Process each college
        for college_data in colleges_data:
            try:
                # Create or get college
                college, created = College.objects.get_or_create(
                    name=college_data['name'],
                    defaults={
                        'short_description': college_data['short_description'],
                        'slug': slugify(college_data['name'])
                    }
                )
                
                if created:
                    self.stdout.write(self.style.SUCCESS(f"Created college: {college.name}"))
                else:
                    self.stdout.write(self.style.SUCCESS(f"Found existing college: {college.name}"))
                
                # Create or update hero section
                hero_data = college_data['hero']
                hero_image = save_image_from_url(hero_data['background_image'], 'hero_background')
                
                hero, _ = HeroSection.objects.update_or_create(
                    college=college,
                    defaults={
                        'title': hero_data['title'],
                        'subtitle': hero_data['subtitle'],
                        'admission_info': hero_data['admission_info'],
                    }
                )
                
                if hero_image:
                    hero.background_image = hero_image
                    hero.save()
                
                # Create badges
                Badge.objects.filter(hero_section=hero).delete()
                for badge_text in hero_data['badges']:
                    Badge.objects.create(hero_section=hero, text=badge_text)
                
                # Create or update about section
                about_data = college_data['about']
                about_image = save_image_from_url(about_data['image'], 'about_image')
                
                about, _ = AboutSection.objects.update_or_create(
                    college=college,
                    defaults={
                        'title': about_data['title'],
                    }
                )
                
                if about_image:
                    about.image = about_image
                    about.save()
                
                # Create about content paragraphs
                AboutContent.objects.filter(about_section=about).delete()
                for i, content in enumerate(about_data['content']):
                    AboutContent.objects.create(
                        about_section=about,
                        content=content,
                        order=i
                    )
                
                # Create or update director section
                director_data = college_data['director']
                director_image = save_image_from_url(director_data['image'], 'director_image')
                
                director, _ = DirectorSection.objects.update_or_create(
                    college=college,
                    defaults={
                        'name': director_data['name'],
                        'title': director_data['title'],
                        'message': director_data['message'],
                    }
                )
                
                if director_image:
                    director.image = director_image
                    director.save()
                
                # Create or update programs section
                programs_data = college_data['programs']
                programs, _ = ProgramsSection.objects.update_or_create(
                    college=college,
                    defaults={
                        'title': programs_data['title'],
                        'description': programs_data['description'],
                        'has_doctoral_programs': programs_data['has_doctoral_programs'],
                    }
                )
                
                # Create programs
                Program.objects.filter(programs_section=programs).delete()
                for i, program in enumerate(programs_data['programs_list']):
                    Program.objects.create(
                        programs_section=programs,
                        name=program['name'],
                        link=program['link'],
                        program_type=program['program_type'],
                        order=i
                    )
                
                # Create or update why choose section
                why_choose_data = college_data['why_choose']
                why_choose_image = save_image_from_url(why_choose_data['image'], 'why_choose_image')
                
                why_choose, _ = WhyChooseSection.objects.update_or_create(
                    college=college,
                    defaults={
                        'title': why_choose_data['title'],
                        'description': why_choose_data['description'],
                        'conclusion': why_choose_data['conclusion'],
                    }
                )
                
                if why_choose_image:
                    why_choose.image = why_choose_image
                    why_choose.save()
                
                # Create features
                Feature.objects.filter(why_choose_section=why_choose).delete()
                for i, feature_text in enumerate(why_choose_data['features']):
                    Feature.objects.create(
                        why_choose_section=why_choose,
                        text=feature_text,
                        order=i
                    )
                
                # Create or update faculty section
                faculty_data = college_data['faculty']
                faculty, _ = FacultySection.objects.update_or_create(
                    college=college,
                    defaults={
                        'title': faculty_data['title'],
                        'description': faculty_data['description'],
                    }
                )
                
                # Create faculty members
                Faculty.objects.filter(faculty_section=faculty).delete()
                for member_data in faculty_data['members']:
                    faculty_image = save_image_from_url(member_data['image'], f"faculty_{slugify(member_data['name'])}")
                    
                    member = Faculty.objects.create(
                        faculty_section=faculty,
                        name=member_data['name'],
                        position=member_data['position'],
                        department=member_data['department'],
                        qualifications=member_data['qualifications'],
                    )
                    
                    if faculty_image:
                        member.image = faculty_image
                        member.save()
                
                # Create or update testimonial section
                testimonial_data = college_data['testimonials']
                testimonials, _ = TestimonialSection.objects.update_or_create(
                    college=college,
                    defaults={
                        'title': testimonial_data['title'],
                    }
                )
                
                # Create testimonials
                Testimonial.objects.filter(testimonial_section=testimonials).delete()
                for testimonial_item in testimonial_data['testimonials_list']:
                    testimonial_image = save_image_from_url(testimonial_item['image'], f"testimonial_{slugify(testimonial_item['name'])}")
                    
                    testimonial = Testimonial.objects.create(
                        testimonial_section=testimonials,
                        name=testimonial_item['name'],
                        course=testimonial_item['course'],
                        company=testimonial_item['company'],
                        testimonial=testimonial_item['testimonial'],
                    )
                    
                    if testimonial_image:
                        testimonial.image = testimonial_image
                        testimonial.save()
                
                # Create or update recruiters section
                recruiters_data = college_data['recruiters']
                recruiters, _ = RecruitersSection.objects.update_or_create(
                    college=college,
                    defaults={
                        'title': recruiters_data['title'],
                    }
                )
                
                # Create recruiters
                Recruiter.objects.filter(recruiters_section=recruiters).delete()
                for recruiter_item in recruiters_data['recruiters_list']:
                    recruiter_logo = save_image_from_url(recruiter_item['logo'], f"recruiter_{slugify(recruiter_item['name'])}")
                    
                    recruiter = Recruiter.objects.create(
                        recruiters_section=recruiters,
                        name=recruiter_item['name'],
                    )
                    
                    if recruiter_logo:
                        recruiter.logo = recruiter_logo
                        recruiter.save()
                
                # Create or update infrastructure section
                infra_data = college_data['infrastructure']
                infra, _ = InfrastructureSection.objects.update_or_create(
                    college=college,
                    defaults={
                        'title': infra_data['title'],
                        'description': infra_data['description'],
                    }
                )
                
                # Create facilities
                Facility.objects.filter(infrastructure_section=infra).delete()
                for i, facility_item in enumerate(infra_data['facilities']):
                    facility_image = save_image_from_url(facility_item['image'], f"facility_{slugify(facility_item['title'])}")
                    
                    facility = Facility.objects.create(
                        infrastructure_section=infra,
                        title=facility_item['title'],
                        description=facility_item['description'],
                        order=i
                    )
                    
                    if facility_image:
                        facility.image = facility_image
                        facility.save()
                
                self.stdout.write(self.style.SUCCESS(f"Successfully imported data for {college.name}"))
                
            except Exception as e:
                self.stdout.write(self.style.ERROR(f"Error importing data for {college_data['name']}: {str(e)}"))
        
        self.stdout.write(self.style.SUCCESS('Successfully imported all college demonstration data'))