예제 #1
0
def test_project_update():
    project = Project()
    project.find('test project update')
    project.project.description = 'project updated'
    project.save()
    db = MongoModel(project='internal',collection='project')
    temp = db.query({'name':'test project update'})
    assert temp['description'] == 'project updated'    
예제 #2
0
def project_view(project_id):
    form = ProjectUpdateForm(csrf_enabled=False)
    project = Project()
    print project_id
    project.get(project_id)
    permission = EditProjectPermission(project_id) 
    edit = False
    if request.method == 'POST':
        edit = True
        if not permission.can():
            abort(403)
        if form.validate_on_submit():
            # name is not edited because it bind to the database name
            project.project.description = form.description.data
            project.save()

    return render_template('project_view.html',project=project,form=form,edit=edit,permission=permission)