示例#1
0
def create_task():
    form = CreateTaskForm()
    if form.validate_on_submit():
        new_task = Task(name=form.name.data,
                        description=form.description.data,
                        point=form.point.data,
                        flag=form.flag.data,
                        is_open=form.is_open.data)
        db.session.add(new_task)
        db.session.commit()
        flash('Task created successfully.', category='success')
        return redirect(url_for('admin'))
    return render_template('create_task.html', form=form)
def add_new_task():
    form = CreateTaskForm(current_status="Open")
    if form.validate_on_submit():
        new_task = Task(task_name=form.taskname.data,
                        task_details=form.taskdescription.data,
                        current_status=form.taskstatus.data,
                        open_date=date.today(),
                        due_date=form.due_date.data,
                        owner=current_user)
        db.session.add(new_task)
        db.session.commit()
        return redirect(url_for("myTasks"))
    return render_template("newtask.html",
                           form=form,
                           current_user=current_user)
示例#3
0
文件: views.py 项目: AdeleD/taskito
    def post(self, request, *args, **kwargs):
        form = CreateTaskForm(request.POST)
        if form.is_valid():
            new_task = form.save(commit=False)
            new_task.creator = request.user
            new_task.created = datetime.now()
            new_task.progress = 0
            new_task.comment_count = 0
            new_task.save()

            messages.info(request, "Your task has been added")
            return HttpResponseRedirect(reverse('taskdetail', args=[new_task.created.year, new_task.created.month, new_task.created.day, new_task.slug]))

        return render(request, 'create-task.html', {
            'form': form,
        })
示例#4
0
def home_view(request):
	current_user = request.user
	message = None
	activity_feeds = get_activity_feeds(request.user.id)
	if request.method == 'POST' and 'create-task-btn' in request.POST:
		create_task_form = CreateTaskForm(data=request.POST)
		if create_task_form.is_valid():
			task_form = create_task_form.save(commit=False)
			task_form.user_id = request.user.id
			task_form.save()
			message = "Task created successfully"
			task_name = request.POST.get('task_name')
			update_activity_feeds(request.user.id, task_name, "you created task ")
			activity_feeds = get_activity_feeds(request.user.id)

	return render(request, 'home.html', {'username': current_user.username, 'message': message,
										'activity_feeds': activity_feeds})
示例#5
0
def create_task():
    user = g.user
    form = CreateTaskForm()

    print 'form:', request.form

    if form.validate_on_submit():
        print 'ok'
        # Check the task doesn't already exist
        task = Task(name=form.name.data,
                    start_date=form.start_date.data,
                    end_date=form.end_date.data,
                    info=form.info.data)
        db.session.add(task)
        db.session.commit()
        flash('created task %s' % form.name.data)
        return redirect(url_for('index'))

    return render_template('index.html', title='Index', user=user, form=form)
示例#6
0
def create_task():
    user = g.user
    form = CreateTaskForm()

    print 'form:', request.form

    if form.validate_on_submit():
        print 'ok'
        # Check the task doesn't already exist
        task = Task(name=form.name.data,
                    start_date=form.start_date.data,
                    end_date=form.end_date.data,
                    info=form.info.data)
        db.session.add(task)
        db.session.commit()
        flash('created task %s' % form.name.data)
        return redirect(url_for('index'))

    return render_template('index.html', title='Index', user=user, form=form)
示例#7
0
def project(id):
    flash("test flash")

    project = Project.query.filter_by(id=id).first()
    meta = db.metadata.tables.keys()
    form = CreateTaskForm()

    g.project = project

    return render_template('project.html',
                           title=project.name,
                           project=project,
                           meta=meta,
                           form=form)
示例#8
0
def index():
    flash("test flash")
    user = g.user
    projects = Project.query.all()
    meta = db.metadata.tables.keys()

    form = CreateTaskForm()

    return render_template('index.html',
                           title='Index',
                           user=user,
                           projects=projects,
                           meta=meta,
                           form=form)
示例#9
0
文件: views.py 项目: Atajan607/TMS
def create_task():
    form = CreateTaskForm()
    return render_template('create_task.html', form=form)