def post(self, vanity_url=None): form = ProviderAddressForm().get_form(self.request.POST) if form.validate(): # Store Provider provider = db.get_provider_from_vanity_url(vanity_url) form.populate_obj(provider) provider.put() vanity_url_form = ProviderVanityURLForm().get_form(obj=provider) self.render_address(provider, address_form=form, vanity_url_form=vanity_url_form, success_message=saved_message) # log the event self.log_event(user=provider.user, msg="Edit Address: Success") else: # show validation error provider = db.get_provider_from_vanity_url(vanity_url) vanity_url_form = ProviderVanityURLForm().get_form(obj=provider) self.render_address(provider, address_form=form, vanity_url_form=vanity_url_form) # log the event self.log_event(user=provider.user, msg="Edit Address: Validation Error")
def get(self, vanity_url=None): provider = db.get_provider_from_vanity_url(vanity_url) logging.info("provider dump before edit:" + str(vars(provider))) address_form = ProviderAddressForm().get_form(obj=provider) vanity_url_form = ProviderVanityURLForm().get_form(obj=provider) self.render_address(provider, address_form=address_form, vanity_url_form=vanity_url_form)
def get(self, patient_key=None): patient = ndb.Key(urlsafe=patient_key).get() address_form = ProviderAddressForm().get_form(obj=patient) self.render_template('patient/address.html', patient=patient, address_form=address_form)
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)