Esempio n. 1
0
def project_url_add(request, pk):
    project = get_object_or_404(Project, pk=pk)
    form = ProjectURLForm(request.POST or None)
    if form.is_valid():
        obj = form.save(commit=False)
        obj.project = project
        obj.save()
        return HttpResponseRedirect(reverse("projects-list"))
    return direct_to_template(request, "project_url_add.html", extra_context={
        "form": form,
        "project": project,
        "nav": {"selected": "projects",},
    })
Esempio n. 2
0
def project_url_add(request, pk):
    project = get_object_or_404(Project, pk=pk)
    form = ProjectURLForm(request.POST or None)
    if form.is_valid():
        obj = form.save(commit=False)
        obj.project = project
        obj.save()
        return HttpResponseRedirect(reverse("projects-list"))
    return direct_to_template(request, "project_url_add.html", extra_context={
        "form": form,
        "project": project,
        "nav": {"selected": "projects",},
    })
Esempio n. 3
0
def project_url_edit(request, pk, url):
    url = ProjectURL.get(url)
    project = Project.get(pk)
    form = ProjectURLForm(request.POST or None, instance=url)
    if form.is_valid():
        obj = form.save(commit=False)
        obj.project = project
        obj.save()
        return HttpResponseRedirect(reverse("projects-list"))
    return direct_to_template(request, "project_url_edit.html", extra_context={
        "form": form,
        "project": project,
        "nav": {"selected": "projects",},
    })
Esempio n. 4
0
def project_url_edit(request, pk, url):
    url = ProjectURL.get(url)
    project = Project.get(pk)
    form = ProjectURLForm(request.POST or None, instance=url)
    if form.is_valid():
        obj = form.save(commit=False)
        obj.project = project
        obj.save()
        return HttpResponseRedirect(reverse("projects-list"))
    return direct_to_template(request,
                              "project_url_edit.html",
                              extra_context={
                                  "form": form,
                                  "project": project,
                                  "nav": {
                                      "selected": "projects",
                                  },
                              })