Exemple #1
0
    def post(self, patient_key=None):
        address_form = ProviderAddressForm().get_form(self.request.POST)

        if address_form.validate():
            # Store Provider
            patient = ndb.Key(urlsafe=patient_key).get()

            address_form.populate_obj(patient)
            patient.put()

            self.render_template('patient/address.html',
                                 patient=patient,
                                 address_form=address_form)

        else:
            # show validation error
            patient = ndb.Key(urlsafe=patient_key).get()

            self.render_template('patient/address.html',
                                 patient=patient,
                                 address_form=address_form)