Example #1
0
def create_resource():
    '''This routine displays an editing page for creating an resource.'''
    form = Resources()
    if form.is_submitted():
        if form.validate() and request.form.get('submit'):
            Resources.create_unit(form)
            return redirect(url_for('web.display_resource',
                            name=form.getName()))
        else:
            return redirect(url_for('web.display_admin_resources'))
    else:
        form.initialize(action='create')
        return display_content(
            form=form,
            title='Create resource',
            breadcrumbs=get_breadcrumbs('resources', 'create')
        )