示例#1
0
def get_entry(project_id,entry):
    form = EntryUpdateForm()
    edit = False
    # entry should be short_name
    if form.validate_on_submit():
        project = Project()
        description = form.description.data
        source = form.source.data
        project.get(project_id)
        project.update_entry(entry,description,source)
        return redirect('/entry/%s/%s/' % (project_id,entry))
    project = Project()
    project.find(project_name)
    return render_template('entry_view.html',project=project,entry=entry,
                           edit=edit,form=form)
示例#2
0
def project_entry_detail(project_id,entry_id):
    # add entry should be a new form, remove from old form
    permission = EditProjectPermission(project_id)
    form = EntryUpdateForm(csrf_enabled=False)
    # we also will need upload form FYI
    project = Project()
    project.get(project_id)
    edit = False
    print project.project.entry.keys()
    entry = project.get_entry(entry_id)
    if form.validate_on_submit():
        if not permission.can():
            abort(403)
        description = form.description.data
        source = form.source.data
        project.update_entry(entry_id,description,source)
        edit = True
    # not to mention we will need a project detail
    return render_template('entry_view.html',project=project,form=form,edit=edit,entry_id=entry_id,permission=permission)