def project_edit(request, proj_id): instance = get_object_or_404(UserProjects, pk=proj_id) form = UserProjectsForm(request.POST or None, instance=instance) if form.is_valid(): form.save() return HttpResponseRedirect('/projects/saved/') return render_to_response('projects/edit.html',context_instance = RequestContext(request,{'form':form}))
def project_create(request): if request.method == 'POST': form = UserProjectsForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect('/projects/saved/') else: form = UserProjectsForm(initial={'user':request.user}) return render_to_response('projects/edit.html',context_instance = RequestContext(request,{'form':form}))