コード例 #1
0
def editFacility(request, facility_pk):
    facility = get_object_or_404(HealthFacilityBase, pk=facility_pk)
    facility_form = FacilityForm(instance=facility, username=request.user)
    if request.method == 'POST':
        facility_form = FacilityForm(instance=facility,
                data=request.POST)
        if facility_form.is_valid():
            facility_form.save()
            return generic_row(request, model=Facilities, pk=facility_pk, partial_row='/cvs/facility/partials/facility_row.html')
        else:
            return render_to_response('cvs/facility/partials/edit_facility.html'
                    , {'facility_form': facility_form, 'facility'
                    : facility},
                    context_instance=RequestContext(request))
    else:
        return render_to_response('cvs/facility/partials/edit_facility.html',
                                  {'facility_form': facility_form,
                                  'facility': facility},
                                  context_instance=RequestContext(request))
コード例 #2
0
def editReporter(request, reporter_pk):
    reporter = get_object_or_404(HealthProviderBase, pk=reporter_pk)
    reporter_form = ReporterForm(instance=reporter, request=request)
    if request.method == 'POST':
        reporter_form = ReporterForm(instance=reporter,
                data=request.POST, request=request)
        if reporter_form.is_valid():
            reporter_form.save()
            return generic_row(request, model=HealthProviderBase, pk=reporter_pk, partial_row='/cvs/reporter/partials/reporter_row.html')
        else:
            return render_to_response('cvs/reporter/partials/edit_reporter.html'
                    , {'reporter_form': reporter_form, 'reporter'
                    : reporter},
                    context_instance=RequestContext(request))
    else:
        return render_to_response('cvs/reporter/partials/edit_reporter.html',
                                  {'reporter_form': reporter_form,
                                  'reporter': reporter},
                                  context_instance=RequestContext(request))