Exemplo n.º 1
0
def project_subprojects(request, project_slug):
    project = get_object_or_404(request.user.projects.live(), slug=project_slug)

    form = SubprojectForm(data=request.POST or None, parent=project)

    if request.method == "POST" and form.is_valid():
        form.save()
        project_dashboard = reverse("projects_subprojects", args=[project.slug])
        return HttpResponseRedirect(project_dashboard)

    subprojects = project.subprojects.all()

    return render_to_response(
        "projects/project_subprojects.html",
        {"form": form, "project": project, "subprojects": subprojects},
        context_instance=RequestContext(request),
    )
Exemplo n.º 2
0
def project_subprojects(request, project_slug):
    project = get_object_or_404(request.user.projects.live(), slug=project_slug)

    form = SubprojectForm(data=request.POST or None, parent=project)

    if request.method == 'POST' and form.is_valid():
        form.save()
        project_dashboard = reverse('projects_detail', args=[project.slug])
        return HttpResponseRedirect(project_dashboard)

    subprojects = project.subprojects.all()

    return render_to_response(
        'projects/project_subprojects.html',
        {'form': form, 'project': project, 'subprojects': subprojects},
        context_instance=RequestContext(request)
    )
Exemplo n.º 3
0
def project_subprojects(request, project_slug):
    project = get_object_or_404(request.user.projects.live(),
                                slug=project_slug)

    form = SubprojectForm(data=request.POST or None, parent=project)

    if request.method == 'POST' and form.is_valid():
        form.save()
        project_dashboard = reverse('projects_detail', args=[project.slug])
        return HttpResponseRedirect(project_dashboard)

    subprojects = project.subprojects.all()

    return render_to_response(
        'projects/project_subprojects.html',
        {'form': form, 'project': project, 'subprojects': subprojects},
        context_instance=RequestContext(request)
    )