Ejemplo n.º 1
0
def add_consorcista(request):
    if request.method == 'POST':
        consorcista_form = ConsorcistaForm(request.POST)
        if consorcista_form.is_valid():
            consorcista_form.save()
            return HttpResponseRedirect(reverse('home'))

    consorcista_form = ConsorcistaForm()
    return render_to_response('iSM/generic_add_form.html', {'form': consorcista_form, 'tipo': 'Consorcista'},
        context_instance=RequestContext(request))
Ejemplo n.º 2
0
def edit_consorcista(request, consorcista_id):
    consorcista = get_object_or_404(Consorcista, pk=consorcista_id)
    if request.method == 'POST':
        consorcista_form = ConsorcistaForm(request.POST, instance=consorcista)
        if consorcista_form.is_valid():
            consorcista_form.save()
            return HttpResponseRedirect(reverse('list-consorcistas'))

    consorcista_form = ConsorcistaForm(instance=consorcista)
    return render_to_response('iSM/generic_edit_form.html', {'form': consorcista_form, 'tipo': 'Consorcista'},
        context_instance=RequestContext(request))
Ejemplo n.º 3
0
def add_consorcista(request):
    if request.method == 'POST':
        consorcista_form = ConsorcistaForm(request.POST)
        if consorcista_form.is_valid():
            consorcista_form.save()
            return HttpResponseRedirect(reverse('home'))

    consorcista_form = ConsorcistaForm()
    return render_to_response('iSM/generic_add_form.html', {
        'form': consorcista_form,
        'tipo': 'Consorcista'
    },
                              context_instance=RequestContext(request))
Ejemplo n.º 4
0
def edit_consorcista(request, consorcista_id):
    consorcista = get_object_or_404(Consorcista, pk=consorcista_id)
    if request.method == 'POST':
        consorcista_form = ConsorcistaForm(request.POST, instance=consorcista)
        if consorcista_form.is_valid():
            consorcista_form.save()
            return HttpResponseRedirect(reverse('list-consorcistas'))

    consorcista_form = ConsorcistaForm(instance=consorcista)
    return render_to_response('iSM/generic_edit_form.html', {
        'form': consorcista_form,
        'tipo': 'Consorcista'
    },
                              context_instance=RequestContext(request))