def create_school(competition, area, size, conference, school_name): school = Schools( **dict(request.data.items() + request.view_args.items()) ) school._id = ObjectId() school.wrestlers = dict([ ( wrestler.get('wrestler_id'), wrestler_object(Wrestler(**wrestler))) for wrestler in school.wrestlers]) school.save() redis_save(remove_OIDs(school), school.school_name, value_fields=(school.competition, school.area, school.size, school.conference), store_func='rpush') defined_school = redis_cli.hset('coach_confirmation', uuid.uuid4(), school.mongo_id) return json.dumps( school, default=remove_OIDs )
def create_confirmation_code(object_id): new_code = uuid.uuid4() redis_cli.hset('coach_confirmation', str(new_code), object_id) return json.dumps(dict(object_id=object_id, confirmation_code=new_code), default=remove_OIDs)