Example #1
0
def addDisciplina(request):
        
    if request.method == "POST":
        form = FormNewDisciplina(request.POST)
        if form.is_valid():
            form.save()
            return render_to_response("geral/salvo.html", context_instance=RequestContext(request))
    else:
        form = FormNewDisciplina()
    return render_to_response("disciplina/Disciplina.html", {'form': form},
        context_instance=RequestContext(request))
Example #2
0
def editarDiscip(request, nr_disci):
        
    editDiscip = get_object_or_404(Disciplina, pk=nr_disci)
    if request.method == "POST":
        form = FormNewDisciplina(request.POST, instance=editDiscip)
        if form.is_valid():
            form.save()
            return render_to_response("geral/salvo.html", context_instance=RequestContext(request))
    else:
        form = FormNewDisciplina(instance=editDiscip)
    return render_to_response("disciplina/editarDiscip.html", {'editDiscip': editDiscip, 'form': form} ,
        context_instance=RequestContext(request))