def _get_result(self, sobject): # get the parent or relation column = self.get_column() parent_id = sobject.get_value(column) parent = self.parents_dict.get(parent_id) if not parent: return super(ForeignKeyElementWdg,self).get_display() template = self.get_option('template') # if not set, then look at the schema if not template: schema = Schema.get_by_project_code( Project.get_project_code() ) search_type = parent.get_base_search_type() template = schema.get_attr_by_search_type(search_type,'display_template') if template: value = NamingUtil.eval_template(template, sobject, parent=parent) else: # NOTE: put something ... anything as a default columns = parent.get_search_type_obj().get_columns() if not len(columns): value = parent.get_value(columns[0]) else: value = parent.get_value(columns[1]) return value
def _get_result(my, sobject): # get the parent or relation column = my.get_column() parent_id = sobject.get_value(column) parent = my.parents_dict.get(parent_id) if not parent: return super(ForeignKeyElementWdg,my).get_display() template = my.get_option('template') # if not set, then look at the schema if not template: schema = Schema.get_by_project_code( Project.get_project_code() ) search_type = parent.get_base_search_type() template = schema.get_attr_by_search_type(search_type,'display_template') if template: value = NamingUtil.eval_template(template, sobject, parent=parent) else: # NOTE: put something ... anything as a default columns = parent.get_search_type_obj().get_columns() if not len(columns): value = parent.get_value(columns[0]) else: value = parent.get_value(columns[1]) return value
def get_display(my): sobject = my.get_current_sobject() template = my.get_option("template") if not template: return super(SimpleTableElementWdg, my).__init__() display = NamingUtil.eval_template(template, sobject) my.value = display return display
def get_display(my): sobject = my.get_current_sobject() template = my.get_option("template") if not template: return super(SimpleTableElementWdg, my).__init__() display = NamingUtil.eval_template(template, sobject) my.value = display return display