Пример #1
0
def suite_new(request):
    form = SuiteForm(request.POST or None, instance=Suite())
    
    if form.is_valid():
        form.save()
        return HttpResponseRedirect('/custs/suites/')
    return render_to_response('custs/suite_new.html',
                              {'suite_form': form},
                              context_instance=RequestContext(request))
Пример #2
0
def suite_edit(request, suite_id):
    suite = get_object_or_404(Suite, pk=suite_id)
    form = SuiteForm(request.POST or None, instance=suite)
    
    if form.is_valid():
        form.save()
        return HttpResponseRedirect('/custs/suites/')
    return render_to_response('custs/suite_edit.html',
                              {'suite_form': form,
                               'suite_id': suite_id},
                              context_instance=RequestContext(request))