Flatlogic Bot fc8bd63b34 V2
2026-02-28 12:23:20 +00:00

59 lines
2.6 KiB
Python

from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from core.models import Profile, Tag, Startup, Investment
class Command(BaseCommand):
help = 'Seed the database with initial mock data'
def handle(self, *args, **kwargs):
self.stdout.write('Seeding initial data...')
# Create Tags
tags = ['Fintech', 'Healthtech', 'Edtech', 'Sustainability', 'Consumer', 'Social Impact', 'AI', 'SaaS']
tag_objs = []
for tag in tags:
obj, created = Tag.objects.get_or_create(name=tag)
tag_objs.append(obj)
# Create Founders
founders = [
{'username': 'alex_founder', 'uni': 'Oxford', 'grad': 2025, 'bio': 'Building the future of finance for Gen Z.'},
{'username': 'sarah_tech', 'uni': 'Imperial', 'grad': 2024, 'bio': 'Tech enthusiast and full-stack developer.'},
{'username': 'michael_green', 'uni': 'UCL', 'grad': 2023, 'bio': 'Sustainability expert looking to change the world.'}
]
founder_profiles = []
for f in founders:
user, created = User.objects.get_or_create(username=f['username'], email=f'{f["username"]}@uni.ac.uk')
if created:
user.set_password('password123')
user.save()
profile = user.profile
profile.role = 'FOUNDER'
profile.university = f['uni']
profile.graduation_year = f['grad']
profile.bio = f['bio']
profile.is_verified = True
profile.save()
founder_profiles.append(profile)
# Create Startups
startups = [
{'name': 'Stashify', 'headline': 'Micro-investing for students', 'amount': 5000, 'founder': founder_profiles[0]},
{'name': 'HealthPulse', 'headline': 'AI-driven wellness tracker', 'amount': 10000, 'founder': founder_profiles[1]},
{'name': 'EcoCart', 'headline': 'Track your carbon footprint while shopping', 'amount': 7500, 'founder': founder_profiles[2]}
]
for s in startups:
Startup.objects.get_or_create(
founder=s['founder'],
name=s['name'],
headline=s['headline'],
description="This is a detailed description of the startup " + s['name'] + ". We are building an MVP and looking for early-stage investors from the university community.",
target_amount=s['amount'],
status='FUNDING'
)
self.stdout.write(self.style.SUCCESS('Successfully seeded data!'))