예제 #1
0
파일: views.py 프로젝트: HackRVA/hacker-web
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}))
예제 #2
0
파일: views.py 프로젝트: HackRVA/hacker-web
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}))