当前位置: 首页>>代码示例>>Python>>正文


Python ProjectForm.user方法代码示例

本文整理汇总了Python中forms.ProjectForm.user方法的典型用法代码示例。如果您正苦于以下问题:Python ProjectForm.user方法的具体用法?Python ProjectForm.user怎么用?Python ProjectForm.user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在forms.ProjectForm的用法示例。


在下文中一共展示了ProjectForm.user方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_project

# 需要导入模块: from forms import ProjectForm [as 别名]
# 或者: from forms.ProjectForm import user [as 别名]
def create_project(request, rfpId):
    context = RequestContext(request)
    user = request.user
    progress_status = 30
    rfp = RfpCampaign.objects.get(pk=rfpId)
    print("RFP is: ")
    print(rfp)
    questions = rfp.get_project_questions()

    if request.method == "POST":
        print(request.POST)
        project = ProjectForm(request.POST, request.FILES, questions=questions)

        if project.is_valid():
            project = Project(**project.cleaned_data)
            project.rfp = rfp
            project.user = user
            project.save()

            if "Next" in request.POST:
                return HttpResponseRedirect(reverse("create_project_budget", args=[project.pk]))
            else:
                return HttpResponseRedirect(reverse("create_project_previous", args=[project.pk]))

    else:
        project = ProjectForm(questions=questions)

    return render_to_response(
        "rfp/create_project.html",
        {"form": project, "user": user, "progress_status": progress_status, "rfp": rfp},
        context,
    )
开发者ID:unistra,项目名称:rfpportal-frcsxb,代码行数:34,代码来源:views.py

示例2: manage

# 需要导入模块: from forms import ProjectForm [as 别名]
# 或者: from forms.ProjectForm import user [as 别名]
def manage(request, project_slug):
    project = Project.get_by_slug(request.user, project_slug)
    
    if request.method == 'POST':
        if 'save' in request.POST:
            form = ProjectForm(request.POST, instance=project)
            if form.is_valid():
                form.user = request.user
                project = form.save()
                request.notifications.add(_(u'Project information updated'))
                return redirect(reverse('tasks:manage', args=(project.slug,)))
        elif 'delete' in request.POST:
            project_title = project.title
            project.task_set.all().delete()
            project.delete()
            request.notifications.add(_(u'Project "%s" has been deleted') \
                % project_title)
            return redirect(reverse('tasks:index'))
        
    form = ProjectForm(instance=project)

    return direct_to_template(request, 'tasks/manage_project.html', dict(
        project_slug=project_slug, project=project, form=form))
开发者ID:idiles,项目名称:taskapp,代码行数:25,代码来源:views.py


注:本文中的forms.ProjectForm.user方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。