# Usage:
# python manage.py seed_users # create all test users
# python manage.py seed_users --clear # wipe existing test users first
from django.core.management.base import BaseCommand
from users.models import User
TEST_PASSWORD = "testpass123"
TEST_EMAIL_DOMAIN = "@ucla.edu"
# ---------------------------------------------------------------------------
# Seed data
# ---------------------------------------------------------------------------
MENTORS = [
{
"email": "mentor.alex.chen@ucla.edu",
"firstName": "Alex",
"lastName": "Chen",
"year": 4,
"major": ["Computer Science"],
"minor": ["Mathematics"],
"hobbies": "competitive programming, building side projects, gaming, hiking",
"clubs": "ACM, hackathon organizing committee, CS tutoring center",
"goals": "I'm a senior CS major heading into a software engineering role at Google. I want to help underclassmen navigate technical interviews, internship applications, and the CS curriculum at UCLA.",
"international": False,
"firstgen": False,
"commuter": False,
"outofstate": True,
"transfer": False,
},
{
"email": "mentor.priya.sharma@ucla.edu",
"firstName": "Priya",
"lastName": "Sharma",
"year": 5,
"major": ["Computer Science", "Cognitive Science"],
"minor": [],
"hobbies": "UX research, sketching interfaces, reading sci-fi, yoga",
"clubs": "Design at UCLA, Women in Tech, HCI research lab",
"goals": "Double major finishing my thesis on human-computer interaction. I want to mentor students interested in product design, UX research, or the intersection of CS and cog sci.",
"international": True,
"firstgen": True,
"commuter": False,
"outofstate": False,
"transfer": False,
},
{
"email": "mentor.james.okafor@ucla.edu",
"firstName": "James",
"lastName": "Okafor",
"year": 4,
"major": ["Biology"],
"minor": ["Chemistry"],
"hobbies": "volunteering at the free clinic, running, cooking West African food, chess",
"clubs": "Pre-med society, Black Pre-med Association, research lab (immunology)",
"goals": "Senior biology pre-med student heading to medical school next fall. I want to help first and second year pre-meds navigate the MCAT, research opportunities, clinical volunteering, and medical school applications.",
"international": False,
"firstgen": True,
"commuter": False,
"outofstate": False,
"transfer": False,
},
{
"email": "mentor.sofia.reyes@ucla.edu",
"firstName": "Sofia",
"lastName": "Reyes",
"year": 4,
"major": ["Statistics"],
"minor": ["Computer Science"],
"hobbies": "data visualization, kaggle competitions, salsa dancing, photography",
"clubs": "Statistics club, Data science union, Latin students association",
"goals": "Stats major with a CS minor going into data science at a startup. I love helping students who want to break into data science, especially those coming from non-traditional backgrounds or switching fields.",
"international": False,
"firstgen": True,
"commuter": True,
"outofstate": False,
"transfer": True,
},
{
"email": "mentor.david.kim@ucla.edu",
"firstName": "David",
"lastName": "Kim",
"year": 5,
"major": ["Mechanical Engineering"],
"minor": [],
"hobbies": "3D printing, robotics competitions, rock climbing, coffee brewing",
"clubs": "ASME, robotics club, engineering mentorship program",
"goals": "Fifth year ME student finishing a thesis on soft robotics. I want to mentor engineering students interested in robotics, product development, or graduate school in engineering.",
"international": False,
"firstgen": False,
"commuter": False,
"outofstate": True,
"transfer": False,
},
{
"email": "mentor.aisha.patel@ucla.edu",
"firstName": "Aisha",
"lastName": "Patel",
"year": 3,
"major": ["Economics"],
"minor": ["Data Science"],
"hobbies": "finance modeling, reading the WSJ, tennis, podcast hosting",
"clubs": "Undergraduate economics association, consulting club, investment club",
"goals": "Junior econ major with a data science minor pursuing investment banking recruiting. I want to help students interested in finance, consulting, or economics research understand the recruiting process and build relevant skills.",
"international": True,
"firstgen": False,
"commuter": False,
"outofstate": False,
"transfer": False,
},
{
"email": "mentor.ethan.nguyen@ucla.edu",
"firstName": "Ethan",
"lastName": "Nguyen",
"year": 4,
"major": ["Electrical Engineering"],
"minor": ["Mathematics"],
"hobbies": "building circuits, amateur radio, playing guitar, hiking",
"clubs": "IEEE, ECE mentorship program, Vietnamese student union",
"goals": "Senior EE student going into embedded systems engineering. I enjoy mentoring students navigating the EE curriculum, finding research opportunities, and deciding between industry and grad school.",
"international": False,
"firstgen": True,
"commuter": True,
"outofstate": False,
"transfer": False,
},
{
"email": "mentor.rachel.goldberg@ucla.edu",
"firstName": "Rachel",
"lastName": "Goldberg",
"year": 4,
"major": ["English"],
"minor": ["Film"],
"hobbies": "screenwriting, literary magazines, film analysis, running",
"clubs": "Daily Bruin, screenwriting club, creative writing workshop",
"goals": "English major with a film minor pursuing a career in entertainment and media. I want to help students interested in writing, journalism, media, or the entertainment industry find their path at UCLA and beyond.",
"international": False,
"firstgen": False,
"commuter": False,
"outofstate": True,
"transfer": False,
},
]
MENTEES = [
{
"email": "mentee.carlos.mendez@ucla.edu",
"firstName": "Carlos",
"lastName": "Mendez",
"year": 1,
"major": ["Computer Science"],
"minor": [],
"hobbies": "coding small games, watching tech YouTube, soccer, chess",
"clubs": "Interested in joining ACM and a hackathon team",
"goals": "First year CS student trying to figure out the major and land my first internship. I want guidance on what classes to take, how to build projects, and how to break into the tech industry as a first-gen student.",
"international": False,
"firstgen": True,
"commuter": True,
"outofstate": False,
"transfer": False,
},
{
"email": "mentee.yuna.park@ucla.edu",
"firstName": "Yuna",
"lastName": "Park",
"year": 2,
"major": ["Biology"],
"minor": [],
"hobbies": "volunteering at hospital, studying for MCAT, journaling, hiking",
"clubs": "Pre-med society, Korean student association, UNICEF at UCLA",
"goals": "Second year biology student on the pre-med track. I want to find good research opportunities, understand the medical school application timeline, and connect with someone who has navigated the pre-med path successfully.",
"international": False,
"firstgen": False,
"commuter": False,
"outofstate": False,
"transfer": False,
},
{
"email": "mentee.omar.hassan@ucla.edu",
"firstName": "Omar",
"lastName": "Hassan",
"year": 1,
"major": ["Mathematics"],
"minor": [],
"hobbies": "competitive math, reading proofs, basketball, cooking",
"clubs": "Math circle, Muslim student association",
"goals": "First year math student considering either pure math research or switching to applied math / data science. I want mentorship on what direction to go and how to find research or internship opportunities.",
"international": True,
"firstgen": True,
"commuter": False,
"outofstate": False,
"transfer": False,
},
{
"email": "mentee.lily.zhang@ucla.edu",
"firstName": "Lily",
"lastName": "Zhang",
"year": 2,
"major": ["Computer Science"],
"minor": ["Cognitive Science"],
"hobbies": "UI design, playing piano, photography, bubble tea crawls",
"clubs": "Design at UCLA, Women in Tech, CS tutoring",
"goals": "Second year CS and cog sci student interested in product design and UX. I want to learn more about the UX research field, build a portfolio, and find internships in product or design roles.",
"international": True,
"firstgen": False,
"commuter": False,
"outofstate": False,
"transfer": False,
},
{
"email": "mentee.marcus.johnson@ucla.edu",
"firstName": "Marcus",
"lastName": "Johnson",
"year": 1,
"major": ["Mechanical Engineering"],
"minor": [],
"hobbies": "taking apart electronics, 3D modeling, skateboarding, gaming",
"clubs": "Looking to join ASME and the robotics club",
"goals": "First year ME student who loves building things. I want to find research or project opportunities, understand the engineering curriculum, and eventually work in robotics or product development.",
"international": False,
"firstgen": False,
"commuter": False,
"outofstate": True,
"transfer": False,
},
{
"email": "mentee.fatima.ali@ucla.edu",
"firstName": "Fatima",
"lastName": "Ali",
"year": 2,
"major": ["Statistics"],
"minor": [],
"hobbies": "analyzing sports stats, learning Python, reading, baking",
"clubs": "Statistics club, Muslim student association, intramural volleyball",
"goals": "Second year stats student who wants to transition into data science. I'm learning Python and SQL on my own and want guidance on breaking into the field, building a portfolio, and finding internships.",
"international": False,
"firstgen": True,
"commuter": True,
"outofstate": False,
"transfer": True,
},
{
"email": "mentee.noah.chen@ucla.edu",
"firstName": "Noah",
"lastName": "Chen",
"year": 1,
"major": ["Economics"],
"minor": [],
"hobbies": "reading about markets, following startups, tennis, cooking",
"clubs": "Undergraduate economics association, interested in investment club",
"goals": "First year econ student interested in either finance, consulting, or tech. I want to understand the recruiting landscape, learn what skills I should be building, and find the right clubs and experiences.",
"international": False,
"firstgen": False,
"commuter": False,
"outofstate": True,
"transfer": False,
},
{
"email": "mentee.amara.osei@ucla.edu",
"firstName": "Amara",
"lastName": "Osei",
"year": 1,
"major": ["English"],
"minor": [],
"hobbies": "creative writing, spoken word poetry, reading fiction, music",
"clubs": "Creative writing workshop, Black student alliance, literary magazine",
"goals": "First year English student passionate about writing and storytelling. I want to explore careers in publishing, journalism, or entertainment and find out how to build relevant experience while at UCLA.",
"international": False,
"firstgen": True,
"commuter": False,
"outofstate": False,
"transfer": False,
},
{
"email": "mentee.isabel.torres@ucla.edu",
"firstName": "Isabel",
"lastName": "Torres",
"year": 2,
"major": ["Biology"],
"minor": ["Data Science"],
"hobbies": "bioinformatics tutorials, hiking, cooking, journaling",
"clubs": "Research lab (computational biology), Latin students association",
"goals": "Second year biology student with a data science minor who wants to go into computational biology or bioinformatics. Looking for guidance on grad school, research opportunities, and how to combine biology and CS skills.",
"international": False,
"firstgen": True,
"commuter": False,
"outofstate": False,
"transfer": False,
},
{
"email": "mentee.kai.nakamura@ucla.edu",
"firstName": "Kai",
"lastName": "Nakamura",
"year": 1,
"major": ["Electrical Engineering"],
"minor": [],
"hobbies": "building circuits, playing guitar, anime, amateur astronomy",
"clubs": "IEEE student chapter, Japanese student union",
"goals": "First year EE student who loves electronics and embedded systems. I want to find hands-on project opportunities, understand the EE curriculum, and figure out whether to go into industry or grad school.",
"international": True,
"firstgen": False,
"commuter": False,
"outofstate": False,
"transfer": False,
},
]
# ---------------------------------------------------------------------------
# Command
# ---------------------------------------------------------------------------
[docs]
class Command(BaseCommand):
help = "Seed the database with test mentors and mentees"
[docs]
def add_arguments(self, parser):
parser.add_argument(
"--clear",
action="store_true",
help="Delete existing test users before seeding",
)
[docs]
def handle(self, *args, **options):
if options["clear"]:
test_emails = (
[m["email"] for m in MENTORS] +
[m["email"] for m in MENTEES]
)
deleted, _ = User.objects.filter(email__in=test_emails).delete()
self.stdout.write(self.style.WARNING(f"Deleted {deleted} existing test users"))
mentors_created = self._seed_users(MENTORS, role="MENTOR")
mentees_created = self._seed_users(MENTEES, role="MENTEE")
self.stdout.write(self.style.SUCCESS(
f"Done. Created {mentors_created} mentors and {mentees_created} mentees."
))
def _seed_users(self, user_data_list, role):
created_count = 0
for data in user_data_list:
email = data["email"]
if User.objects.filter(email=email).exists():
self.stdout.write(f" Skipping {email} (already exists)")
continue
try:
user = User.objects.create_user(
email=email,
password=TEST_PASSWORD,
role=role,
)
# Set profile fields directly to bypass survey flow
for field in User.SURVEY_FIELDS:
if field in data:
setattr(user, field, data[field])
# Use .update() to bypass full_clean on save
User.objects.filter(email=email).update(
firstName=data.get("firstName", ""),
lastName=data.get("lastName", ""),
year=data.get("year", 0),
major=data.get("major", []),
minor=data.get("minor", []),
hobbies=data.get("hobbies", ""),
clubs=data.get("clubs", ""),
goals=data.get("goals", ""),
otherBackground=data.get("otherBackground", ""),
international=data.get("international", False),
commuter=data.get("commuter", False),
firstgen=data.get("firstgen", False),
outofstate=data.get("outofstate", False),
transfer=data.get("transfer", False),
)
created_count += 1
self.stdout.write(f" Created {role}: {email}")
except Exception as e:
self.stdout.write(
self.style.ERROR(f" Failed to create {email}: {e}")
)
return created_count