def edit(self, id): # We need to recheck auth in here so we can pass in the id if not h.auth.authorized(h.auth.Or(h.auth.is_same_zookeepr_user(id), h.auth.has_organiser_role)): # Raise a no_auth error h.auth.no_role() c.form = 'edit' c.person = Person.find_by_id(id) c.social_networks = SocialNetwork.find_all() c.person.fetch_social_networks() defaults = h.object_to_defaults(c.person, 'person') defaults['person.email_address2'] = c.person.email_address form = render('/person/edit.mako') return htmlfill.render(form, defaults)
def edit(self, id): # We need to recheck auth in here so we can pass in the id if not h.auth.authorized( h.auth.Or(h.auth.is_same_zookeepr_user(id), h.auth.has_organiser_role)): # Raise a no_auth error h.auth.no_role() c.form = 'edit' c.person = Person.find_by_id(id) c.social_networks = SocialNetwork.find_all() c.person.fetch_social_networks() defaults = h.object_to_defaults(c.person, 'person') defaults['person.email_address2'] = c.person.email_address form = render('/person/edit.mako') return htmlfill.render(form, defaults)
def new(self): # Do we allow account creation? if lca_info['account_creation']: """Create a new person form. """ if h.signed_in_person(): h.flash("You're already logged in") redirect_to('home') defaults = { 'person.country': 'AUSTRALIA', } if h.lca_rego['personal_info']['home_address'] == 'no': defaults['person.address1'] = 'not available' defaults['person.city'] = 'not available' defaults['person.postcode'] = 'not available' c.social_networks = SocialNetwork.find_all() form = render('/person/new.mako') return htmlfill.render(form, defaults) else: return render('/not_allowed.mako')