Example #1
0
 def choose_element_form(self, post, element, choices):
     """Fill the form from a selected participant element."""
     session = self.session
     sef = ElementEdit(post, element)
     sef.label.data = get_element_label(session, element.element_id)
     parent_prop = parent_property(session, element.element_id)
     if parent_prop:
         sef.parent_link_property.data = make_curie(parent_prop)
     else:
         sef.parent_link_property.data = None
     sef.expression_type.data = element.expression_type
     if element.expression_type == 'individual':
         ind = get_pelements_individual(session, element.element_id)
         sef.individual.data = make_curie(ind)
     elif element.expression_type == 'some_term':
         term = get_pelements_term(session, element.element_id)
         sef.term.data = make_curie(term)
     self.element_form = self.finish_element_form(sef, element, choices)
Example #2
0
 def set_element_form(self, element, choices):
     """Initialize the form that displays participant elements."""
     if element is None:
         sef = InactiveElementEdit()
         session = self.request.dbsession
         self.set_element_form_choices(sef)
         sef.element_choice.choices = choices
         sef.individual.choices = individual_choice(session, None)  # need to get narrative
         sef.term.choices = term_choice(session)
         self.element_form = sef
     else:
         session = self.session
         sef = ElementEdit(None, element)
         if element.expression_type == 'individual':
             ind = get_pelements_individual(session, element.element_id)
             sef.individual.data = make_curie(ind)
         elif element.expression_type == 'some_term':
             term = get_pelements_term(session, element.element_id)
             sef.term.data = make_curie(term)
         self.element_form = self.finish_element_form(sef, element, choices)