Exemplo n.º 1
0
def projects():
    if request.method == 'POST':
        project = Project()
        project.parse(request.form)
        db.session.add(project)
        db.session.commit()
    projects = Project.query.all()
    return render_template('projects/index.html', projects=projects)
Exemplo n.º 2
0
def project_add():
    project_form = ProjectForm(request.form)
    if project_form.validate_on_submit():
        project = Project()
        project_form.populate_obj(project)
        project.image = get_image_from_file_field(project_form.image, request)
        db.session.add(project)

    projects = Project.query.all()
    return render_template('projects/add.html', projects=projects, form=project_form)
def create_mock_project_by_id(id):
    project = Project()
    project.id = id
    project.name = "Project"
    project.description = "Description"
    project.start_date = datetime.date(2015, 12, 12)
    project.end_date = datetime.date(2015, 12, 12)
    project.location = "here"
    project.contact_phone = "666666666"
    project.image = None
    db.session.add(project)
Exemplo n.º 4
0
def project_add():
    project_form = ProjectForm(request.form)
    if project_form.validate_on_submit():
        project = Project()
        project_form.populate_obj(project)
        project.image = get_image_from_file_field(project_form.image, request)
        db.session.add(project)

    projects = Project.query.all()
    return render_template('projects/add.html',
                           projects=projects,
                           form=project_form)
Exemplo n.º 5
0
def project_add():

    project_form = ProjectForm(request.form)

    if project_form.validate_on_submit():
        project = Project()
        project_form.populate_obj(project)
        project.image = get_image_from_file_field(project_form.image, request)
        db.session.add(project)
        db.session.commit()

        flash('Project created', 'success')
        return redirect(url_for('web.project_index'))

    return render_template('projects/add.html', form=project_form)
Exemplo n.º 6
0
def project_add():

    project_form = ProjectForm(request.form)

    if project_form.validate_on_submit():
        project = Project()
        project_form.populate_obj(project)
        project.image = get_image_from_file_field(project_form.image, request)
        db.session.add(project)
        db.session.commit()

        flash('Project created', 'success')
        return redirect(url_for('web.project_index'))

    return render_template('projects/add.html', form=project_form)
Exemplo n.º 7
0
def project_add():

    # Don't pass request.form as flask_wtf do it automatically, and
    # if request.form is passed it won't load the images!!!!
    project_form = ProjectForm()

    if project_form.validate_on_submit():
        project = Project()
        project_form.populate_obj(project)
        project.image = get_image_from_file_field(project_form.image, request)
        db.session.add(project)
        db.session.commit()

        flash('Project created', 'success')
        return redirect(url_for('web.project_index'))
    return render_template('projects/add.html', form=project_form)
Exemplo n.º 8
0
def project_add():

    # Don't pass request.form as flask_wtf do it automatically, and
    # if request.form is passed it won't load the images!!!!
    project_form = ProjectForm()

    if project_form.validate_on_submit():
        project = Project()
        project_form.populate_obj(project)
        project.image = get_image_from_file_field(project_form.image, request)
        db.session.add(project)
        db.session.commit()

        flash('Project created', 'success')
        return redirect(url_for('web.project_index'))
    return render_template('projects/add.html', form=project_form)