-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdb_populate.py
23 lines (16 loc) · 1.09 KB
/
db_populate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from app.models import *
import csv
Fellow.objects.all().delete()
# Section 1: Open the CSV - direct download with no filename changes from the Google doc
print "Getting data...\n"
input_file = csv.DictReader(open("fellows.csv"))
# Parse fieldnames
print "Adding fellows to the database...\n"
for fellow in input_file:
q1 = fellow["What's something you built or worked on during the residency that you are really proud of?"]
q2 = fellow["What's your favorite programming language?"]
q3 = fellow["How has your vision for the role of tech in your/your community's life changed since April?"]
q4 = fellow["What did you do post-residency to relax/recover/have fun/etc?"]
# Commit to the database
fellow = Fellow(first_name = fellow['first_name'], last_name=fellow['last_name'], where_from = fellow['where_from'], cohort = "2004 Spring", current_job = fellow['current_job'],post_2014_residency_q1 = q1, post_2014_residency_q2 = q2, post_2014_residency_q3 = q3, post_2014_residency_q4 = q4, page_text=fellow['page_text'], github_username = fellow['github_username'])
fellow.save()