Beispiel #1
0
def edit(project_id):
    set_project(project_id = project_id)
    form = NewProjectForm(obj=current_project)
    if form.validate_on_submit():
        current_project.update(set__name=form.name.data)
        current_project.update(set__description=form.description.data)
        return redirect(url_for('project._project', project_id=current_project.id))
    return render_template('edit_project.html', form=form)
Beispiel #2
0
def _new_project():
    form = NewProjectForm()
    if form.validate_on_submit():
        name = form.name.data
        description = form.description.data
        print "project count", Project.objects(name=name).count()
        if Project.objects(name=name).count() == 0:
            project = Project(name=name, description=description)
            project.save()
            project.add_user(current_user.to_dbref())
            current_user.add_project(project)
            return redirect(url_for("project._project", project_id=project.id))
        else:
            flash("Project name already exists")

    return render_template('new_project.html', form=form)
Beispiel #3
0
def _new_project():
	form = NewProjectForm()
	if form.validate_on_submit():
	    name = form.name.data
	    description = form.description.data
            print "project count", Project.objects(name = name).count()
            if Project.objects(name = name).count() ==0:
                    project = Project(name=name, description=description)
                    project.save()
                    project.add_user(current_user.to_dbref())
                    current_user.add_project(project)
                    return redirect(url_for("project._project", project_id = project.id))
            else:
                    flash("Project name already exists")
                    
	return render_template('new_project.html', form=form)