def main(): print "Creating organizations..." brown = models.Organization(name='Brown College', description='The best residential college.', image='/static/img/who/brown-college.png', website='http://brown.rice.edu') brown.put() mcmurtry = models.Organization(name='McMurtry College', description='Not the best residential college.', image='/static/img/who/mcmurtry-college.png', website='http://mcmurtry.rice.edu') mcmurtry.put() baker = models.Organization(name='Baker College', description='Not the best residential college.', image='/static/img/who/mcmurtry-college.png', carousel_show_name=False, website='http://baker.rice.edu') baker.put() martel = models.Organization(name='Martel College', description='Best deck.', website='http://martel.rice.edu') martel.put() testing = models.Organization(name='Testing', description='Test 1 2 3', website='foo.bar') testing.put() print "Done." print "Creating admins..." users = [ ('wa1', '*****@*****.**'), ('dan1', '*****@*****.**'), ('jcc7', '*****@*****.**'), ('jbb4', '*****@*****.**'), ('cmp1', '*****@*****.**'), ('pe4', '*****@*****.**'), ('wcl2', '*****@*****.**') ] admins = [] for net_id, email in users: voter = models.get_voter(net_id, create=True) admin = models.Admin(voter=voter, email=email).put() admins.append(admin) for admin in admins[:3]: models.OrganizationAdmin(admin=admin, organization=brown).put() models.OrganizationAdmin(admin=admins[3], organization=mcmurtry).put() models.OrganizationAdmin(admin=admins[4], organization=baker).put() models.OrganizationAdmin(admin=admins[5], organization=martel).put() models.OrganizationAdmin(admin=admins[6], organization=testing).put() print "Done."
def create_organization(self, data): org = models.Organization(name=data['name'], description=data['description'], website=data['website']) org.put() webapputils.respond(self, 'OK', 'Done')