def add_project(request): if request.method == "POST": form = ProjectForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('project')) else: form = ProjectForm() return render_to_response('release/add_project.html', locals(), RequestContext(request))
def edit_project(request, ID): the_project = Project.objects.get(id=str(ID)) the_project.pre_host_list = list(eval(the_project.pre_host_list)) the_project.pro_host_list = list(eval(the_project.pro_host_list)) if request.method == "POST": form = ProjectForm(request.POST, instance=the_project) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('project')) else: form = ProjectForm(instance=the_project) return render_to_response('release/edit_project.html', locals(), RequestContext(request))