def display_program(name=None): '''Configure and display a program page.''' program = check_unit(Programs.read_unit(name)) return display_content( breadcrumbs=get_breadcrumbs('academics', program.get('name')), image=Images.read_tagged_unit(name), title=program.get('title'), primary=program.get('majorDescription'), tabList=create_program_tab_list(program), editable=True, editableUrl=url_for('web.update_program', name=name) )
def update_program(name): '''Configure the editing for the program pages. Because all of the program data except the model schedule comes from CIT, this routine will only support updates to the model schedule. The administrator cannot edit the name of the program. ''' form = Programs() if form.is_submitted(): if form.validate() and request.form.get('submit'): Programs.update_unit(form) else: program = Programs.read_unit(name) if program: form.initialize(name=name, action='update', document=program) return display_content( form=form, title='Edit: ' + name, breadcrumbs=get_breadcrumbs('academics', name, 'edit') ) return redirect(url_for('web.display_program', name=name))