def refugee_update(request, person_id): person_details = get_object_or_404(Person, person_id=person_id) refugee_details = get_object_or_404(Refugee, person_id=person_id) init_person = {'person_id' : person_details.person_id, 'person_name' : person_details.person_name, \ 'gender' : person_details.gender, 'age' : person_details.age , 'hair_color' : person_details.hair_color,\ 'wounds' : person_details.wounds, 'height' : person_details.height, 'identification_mark' : \ person_details.identification_mark, 'color_complexation' : person_details.color_complexation } init_refugee = { 'health_status': refugee_details.health_status, 'center_id': refugee_details.center_id } if request.method == 'POST': person_update_form = PersonUpdateForm(request.POST) refugee_update_form = RefugeeUpdateForm(request.POST) valid_person_update_form = person_update_form.is_valid() valid_refugee_update_form = refugee_update_form.is_valid() if valid_person_update_form and valid_refugee_update_form: person_form_details = person_update_form.save(commit=False) refugee_form_details = refugee_update_form.save(commit=False) update_p = Person.objects.get(person_id=person_id) update_r = Person.objects.get(person_id=person_id) update_p.person_name = person_form_details.person_name update_p.gender = person_form_details.gender update_p.age = person_form_details.age update_p.hair_color = person_form_details.hair_color update_p.wounds = person_form_details.wounds update_p.height = person_form_details.height update_p.identification_mark = person_form_details.identification_mark update_p.color_complaxation = person_form_details.color_complexation update_r.center_id = refugee_form_details.center_id update_r.health_status = refugee_form_details.health_status update_p.save() update_r.save() return HttpResponseRedirect('/crisis/') else: return render_to_response( 'person/refugee_update.html', { 'refugee_form': RefugeeUpdateForm(init_refugee), 'person_form': PersonUpdateForm(init_person) }, RequestContext(request)) else: return render_to_response( 'person/refugee_update.html', { 'refugee_form': RefugeeUpdateForm(init_refugee), 'person_form': PersonUpdateForm(init_person) }, RequestContext(request))
def deceased_update(request, person_id): person_details = get_object_or_404(Person, person_id=person_id) deceased_details = get_object_or_404(Deceased, person_id=person_id) init_person = {'person_id' : person_details.person_id, 'person_name' : person_details.person_name, \ 'gender' : person_details.gender, 'age' : person_details.age , 'hair_color' : person_details.hair_color,\ 'wounds' : person_details.wounds, 'height' : person_details.height, 'identification_mark' : \ person_details.identification_mark, 'color_complexation' : person_details.color_complexation } init_deceased = {'latitude' : deceased_details.latitude, 'longitude' : deceased_details.longitude,\ 'idenitified' : deceased_details.idenitified } if request.method == 'POST': person_update_form = PersonUpdateForm(request.POST) deceased_update_form = DeceasedUpdateForm(request.POST) valid_person_update_form = person_update_form.is_valid() valid_deceased_update_form = deceased_update_form.is_valid() if valid_person_update_form and valid_deceased_update_form: person_form_details = person_update_form.save(commit=False) deceased_form_details = deceased_update_form.save(commit=False) update_p = Person.objects.get(person_id=person_id) update_d = Person.objects.get(person_id=person_id) update_p.person_name = person_form_details.person_name update_p.gender = person_form_details.gender update_p.age = person_form_details.age update_p.hair_color = person_form_details.hair_color update_p.wounds = person_form_details.wounds update_p.height = person_form_details.height update_p.identification_mark = person_form_details.identification_mark update_p.color_complaxation = person_form_details.color_complexation update_d.latitude = deceased_form_details.latitude update_d.longitude = deceased_form_details.longitude update_d.idenitified = deceased_form_details.idenitified update_p.save() update_d.save() return HttpResponseRedirect('/crisis/') else: return render_to_response( 'person/deceased_update.html', { 'deceased_form': DeceasedUpdateForm(init_deceased), 'person_form': PersonUpdateForm(init_person) }, RequestContext(request)) else: return render_to_response( 'person/deceased_update.html', { 'deceased_form': DeceasedUpdateForm(init_deceased), 'person_form': PersonUpdateForm(init_person) }, RequestContext(request))
def deceased_update(request, person_id): person_details = get_object_or_404(Person, person_id = person_id) deceased_details = get_object_or_404(Deceased, person_id = person_id) init_person = {'person_id' : person_details.person_id, 'person_name' : person_details.person_name, \ 'gender' : person_details.gender, 'age' : person_details.age , 'hair_color' : person_details.hair_color,\ 'wounds' : person_details.wounds, 'height' : person_details.height, 'identification_mark' : \ person_details.identification_mark, 'color_complexation' : person_details.color_complexation } init_deceased = {'latitude' : deceased_details.latitude, 'longitude' : deceased_details.longitude,\ 'idenitified' : deceased_details.idenitified } if request.method == 'POST': person_update_form = PersonUpdateForm(request.POST) deceased_update_form = DeceasedUpdateForm(request.POST) valid_person_update_form = person_update_form.is_valid() valid_deceased_update_form = deceased_update_form.is_valid() if valid_person_update_form and valid_deceased_update_form: person_form_details = person_update_form.save(commit = False) deceased_form_details = deceased_update_form.save(commit = False) update_p = Person.objects.get(person_id = person_id) update_d = Person.objects.get(person_id = person_id) update_p.person_name = person_form_details.person_name update_p.gender = person_form_details.gender update_p.age = person_form_details.age update_p.hair_color = person_form_details.hair_color update_p.wounds = person_form_details.wounds update_p.height = person_form_details.height update_p.identification_mark = person_form_details.identification_mark update_p.color_complaxation = person_form_details.color_complexation update_d.latitude = deceased_form_details.latitude update_d.longitude = deceased_form_details.longitude update_d.idenitified = deceased_form_details.idenitified update_p.save() update_d.save() return HttpResponseRedirect('/crisis/') else: return render_to_response('person/deceased_update.html', {'deceased_form' : DeceasedUpdateForm(init_deceased), 'person_form' : PersonUpdateForm(init_person)}, RequestContext(request)) else: return render_to_response('person/deceased_update.html', {'deceased_form' : DeceasedUpdateForm(init_deceased), 'person_form' : PersonUpdateForm(init_person)}, RequestContext(request))
def refugee_update(request, person_id): person_details = get_object_or_404(Person, person_id = person_id) refugee_details = get_object_or_404(Refugee, person_id = person_id) init_person = {'person_id' : person_details.person_id, 'person_name' : person_details.person_name, \ 'gender' : person_details.gender, 'age' : person_details.age , 'hair_color' : person_details.hair_color,\ 'wounds' : person_details.wounds, 'height' : person_details.height, 'identification_mark' : \ person_details.identification_mark, 'color_complexation' : person_details.color_complexation } init_refugee = {'health_status' : refugee_details.health_status, 'center_id' : refugee_details.center_id } if request.method == 'POST': person_update_form = PersonUpdateForm(request.POST) refugee_update_form = RefugeeUpdateForm(request.POST) valid_person_update_form = person_update_form.is_valid() valid_refugee_update_form = refugee_update_form.is_valid() if valid_person_update_form and valid_refugee_update_form: person_form_details = person_update_form.save(commit = False) refugee_form_details = refugee_update_form.save(commit = False) update_p = Person.objects.get(person_id = person_id) update_r = Person.objects.get(person_id = person_id) update_p.person_name = person_form_details.person_name update_p.gender = person_form_details.gender update_p.age = person_form_details.age update_p.hair_color = person_form_details.hair_color update_p.wounds = person_form_details.wounds update_p.height = person_form_details.height update_p.identification_mark = person_form_details.identification_mark update_p.color_complaxation = person_form_details.color_complexation update_r.center_id = refugee_form_details.center_id update_r.health_status = refugee_form_details.health_status update_p.save() update_r.save() return HttpResponseRedirect('/crisis/') else: return render_to_response('person/refugee_update.html', {'refugee_form' : RefugeeUpdateForm(init_refugee), 'person_form' : PersonUpdateForm(init_person)}, RequestContext(request)) else: return render_to_response('person/refugee_update.html', {'refugee_form' : RefugeeUpdateForm(init_refugee), 'person_form' : PersonUpdateForm(init_person)}, RequestContext(request))