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",}, })
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",}, })
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", }, })