コード例 #1
0
ファイル: views.py プロジェクト: borland667/inSendMail
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))
コード例 #2
0
ファイル: views.py プロジェクト: borland667/inSendMail
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))
コード例 #3
0
ファイル: views.py プロジェクト: mguillech/inSendMail
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))
コード例 #4
0
ファイル: views.py プロジェクト: mguillech/inSendMail
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))