(u, p)
return render_template('edit_project.html',
        project=p,
        form=form
    )
Edit an existing project.
Edit an existing project.
Edit an existing project .
def edit_project(u, p):
    """
    Edit an existing project.
    """
    if p.owner.id != g.user.id:
        # Project isn't public and the viewer isn't the project owner.
        # (403 Forbidden)
        return abort(403)

    form = ProjectDetailsForm(obj=p)
    if form.validate_on_submit():
        old_p = Project.by_name_and_owner(form.name.data, g.user)
        if old_p and old_p.id != p.id:
            form.name.errors = [
                wtf.ValidationError('Project name must be unique.')
            ]
        else:
            p.name = form.name.data
            p.website = form.website.data
            p.public = form.public.data
            p.full_name = '{0}/{1}'.format(g.user.username, p.name)
            db.session.commit()
            return redirect(url_for('.dashboard', u=u.username))

    return render_template('edit_project.html',
        project=p,
        form=form
    )
def edit_project ( u , p ) : if p . owner . id != g . user . id : # Project isn't public and the viewer isn't the project owner. # (403 Forbidden) return abort ( 403 ) form = ProjectDetailsForm ( obj = p ) if form . validate_on_submit ( ) : old_p = Project . by_name_and_owner ( form . name . data , g . user ) if old_p and old_p . id != p . id : form . name . errors = [ wtf . ValidationError ( 'Project name must be unique.' ) ] else : p . name = form . name . data p . website = form . website . data p . public = form . public . data p . full_name = '{0}/{1}' . format ( g . user . username , p . name ) db . session . commit ( ) return redirect ( url_for ( '.dashboard' , u = u . username ) ) return render_template ( 'edit_project.html' , project = p , form = form )