コード例 #1
0
ファイル: setup.py プロジェクト: brownplt/k3
def startDeptDefault(adminName, adminEmail, techEmail, deptname, shortname):
  dept = Department(
    name=deptname,
    shortname=shortname,
    lastChange=0,
    headerImage='',
    logoImage='',
    resumeImage='',
    headerBgImage='',
    contactName=adminName,
    contactEmail=adminEmail,
    techEmail=techEmail)
  dept.save()

  unverified_user = UnverifiedUser( \
    role='admin',
    name=adminName,
    email=adminEmail,
    department=dept)
  unverified_user.save()

  ResumeInit().process_request(None)

  create_account = bcap.grant('get-admin-email-and-create', unverified_user)

  posn = ApplicantPosition(department=dept, name='Assistant Professor',
    shortform='AsstProf', autoemail=True)
  posn.save()

  c = ComponentType(department=dept,type='statement',name='Cover Letter',short='Cover')
  c.save()
  c = ComponentType(department=dept,type='statement',name='Curriculum Vitae',short='CV')
  c.save()
  c = ComponentType(department=dept,type='statement',name='Research Statement',short='Research')
  c.save()
  c = ComponentType(department=dept,type='statement',name='Teaching Statement',short='Teaching')
  c.save()
  c = ComponentType(department=dept,type='contactweb',name='Home Page',short='home')
  c.save()
  c = ComponentType(department=dept,type='contactweb',name='Application Web Page',short='app')
  c.save()
  c = ComponentType(department=dept,type='contactlong',name='Optional Notes',short='addtl')
  c.save()

  return "To get started, go here: %s/new-account/#%s" % \
    (bcap.this_server_url_prefix(), create_account.serialize())
コード例 #2
0
ファイル: setup.py プロジェクト: brownplt/k3
def make_some_applicants(cs):
  print("There are %s applicants." % len(Applicant.objects.all()))
  # skip this if students exist
  if len(Applicant.objects.all()) >= 2: return

  student = ApplicantPosition(name='Student', shortform='Student', autoemail=True, department=cs)
  student.save()

  a1auth = AuthInfo(email='bob@fake', name='Bob the Applicant', role='applicant', department=cs)
  a1auth.save()  

  a1 = Applicant(auth=a1auth, gender='Male', ethnicity='zo', firstname='Bob', lastname='Applicant', country='Namibia', department=cs, position=student)
  a1.save()

  a2auth = AuthInfo(email='henry@fake', name='Henry the Applicant', role='applicant', department=cs)
  a2auth.save()

  a1 = Applicant(auth=a2auth, gender='Male', ethnicity='w', firstname='Henry', lastname='Applicant', country='Zambia', department=cs, position=student)
  a1.save()