예제 #1
0
파일: views.py 프로젝트: dextervip/rpv
def addTipoDeSala(request):
        
    if request.method == "POST":
        form = FormTipoDeSala(request.POST)
        if form.is_valid():
            form.save()
            return render_to_response("geral/salvo.html", context_instance=RequestContext(request))
    else:
        form = FormTipoDeSala()
    return render_to_response("secretaria/novoTipoSala.html", {'form': form},
        context_instance=RequestContext(request))
예제 #2
0
파일: views.py 프로젝트: dextervip/rpv
def editarTipoSala(request, nr_tipo):
        
    editTipo = get_object_or_404(TipoDeSala, pk=nr_tipo)
    if request.method == "POST":
        form = FormTipoDeSala(request.POST, instance=editTipo)
        if form.is_valid():
            form.save()
            return render_to_response("geral/salvo.html", context_instance=RequestContext(request))
    else:
        form = FormTipoDeSala(instance=editTipo)
    return render_to_response("secretaria/editarTipoSala.html", {'editTipo': editTipo, 'form': form} ,
        context_instance=RequestContext(request))