Esempio n. 1
0
def modificar_informe(request, inf_id):
    inf = Informe.objects.get(id=inf_id)
    dictionary = model_to_dict(inf, fields=[], exclude=[])
    #form = forms.InformeForm(dictionary)
    if request.method == 'POST':
        form = InformeForm(data=request.POST)
        if form.is_valid():
            inf.titulo = form.cleaned_data['titulo']
            inf.texto = strip_tags(form.cleaned_data['texto'])
            inf.fecha = form.cleaned_data['fecha']
            inf.save()
            return HttpResponseRedirect(reverse('st_students_list'))

    else:
        form = forms.InformeForm(dictionary)

    context = {
        'informe_form': form,
    }
    return render_to_response(
        'students/st_modificar_informe.html',
        context,
        context_instance=RequestContext(request),
    )
Esempio n. 2
0
def modificar_informe(request, inf_id):
    inf = Informe.objects.get(id=inf_id)
    dictionary = model_to_dict(inf, fields=[], exclude=[])
    #form = forms.InformeForm(dictionary)
    if request.method == 'POST':
        form = InformeForm(data=request.POST)
        if form.is_valid():
            inf.titulo = form.cleaned_data['titulo']
            inf.texto = strip_tags(form.cleaned_data['texto'])
            inf.fecha = form.cleaned_data['fecha']
            inf.save()
            return HttpResponseRedirect(reverse('st_students_list'))

    else:
        form = forms.InformeForm(dictionary)

    context = {
        'informe_form': form,
    }
    return render_to_response(
        'students/st_modificar_informe.html',
         context,
         context_instance = RequestContext(request),
    )
Esempio n. 3
0
def nuevo_informe(request, st_id):
    st = Alumno.objects.get(pk=st_id)
    if request.method == 'POST':
        form = InformeForm(data=request.POST)
        if form.is_valid():
            informe = form.save(commit=False)
            informe.alumno = Alumno.objects.get(pk=st_id)
            informe.maestra = request.user.empleado.maestra
            informe.texto = strip_tags(informe.texto)
            form.save()
            return HttpResponseRedirect(reverse('st_students_list'))

    else:
        form = InformeForm()

    context = {
        'informe_form': form,
        'st': st,
    }
    return render_to_response(
        'students/st_nuevo_informe.html',
        context,
        context_instance=RequestContext(request),
    )
Esempio n. 4
0
def nuevo_informe(request, st_id):
    st = Alumno.objects.get(pk=st_id)
    if request.method == 'POST':
        form = InformeForm(data=request.POST)
        if form.is_valid():
            informe = form.save(commit=False)
            informe.alumno = Alumno.objects.get(pk=st_id)
            informe.maestra = request.user.empleado.maestra
            informe.texto = strip_tags(informe.texto)
            form.save()
            return HttpResponseRedirect(reverse('st_students_list'))

    else:
        form = InformeForm()

    context = {
        'informe_form': form, 'st': st,
    }
    return render_to_response(
        'students/st_nuevo_informe.html',
         context,
         context_instance = RequestContext(request),
    )