def insert_item(argv): '''Takes the system arguments as parameter and then inserts the item. Keyword arguments: argv -- An array of command line arguments passed to the program. ''' if argv[2] == "school": school = School.create(name=argv[3]) print "New school: " + str(School.get(School.name == argv[3])) elif argv[2] == "batch": batch = Batch.create(school=argv[3], name=argv[4]) print "New batch: " + str(Batch.get(Batch.name == argv[4])) elif argv[2] == "student": print "New student:", if len(argv) > 6: student = Student.create(batch=argv[3], age=argv[4], last_name=argv[5], first_name=argv[6]) print str(Student.get(Student.age == argv[4] and Student.last_name == argv[5] and Student.first_name == argv[6])) else: student = Student.create(batch=argv[3], age=argv[4], last_name=argv[5]) print str(Student.get(Student.age == argv[4] and Student.last_name == argv[5])) elif argv[2] == "exercise": exercise = Exercise.create(student=argv[3], subject=argv[4], note=argv[5]) print "New Exercise: " + str(exercise)