示例#1
0
文件: views.py 项目: danribeiro/sigee
def adiciona_fonte(request):
    if request.method == "POST":
        form = FormFonteEmissaoECV(request.POST, request.FILES)
        if form.is_valid():
            form.save()
            return render_to_response(
                "fonteecv/add_fonte.html", {"form": form}, context_instance=RequestContext(request)
            )
    else:
        form = FormFonteEmissaoECV()
    return render_to_response("fonteecv/add_fonte.html", {"form": form}, context_instance=RequestContext(request))
示例#2
0
文件: views.py 项目: danribeiro/sigee
def edita_fonte(request, nr_item):
    objeto = FonteEmissaoECV.objects.get(pk=nr_item)
    if request.method == "POST":
        form = FormFonteEmissaoECV(request.POST, instance=objeto)
        if form.is_valid():
            form.save()
            return render_to_response(
                "fonteecv/edita_fonte.html", {"form": form}, context_instance=RequestContext(request)
            )
    else:
        form = FormFonteEmissaoECV(instance=objeto)
    return render_to_response("fonteecv/edita_fonte.html", {"form": form}, context_instance=RequestContext(request))