def GetSchoolFormById(school_id): school = orm.School.query.get(int(school_id)) if school is None: return None schoolform = SchoolForm() schoolform.id.data = school.id schoolform.name.data = school.name schoolform.area_id.data = school.area_id schoolform.area_name = school.area.name schoolform.teachdesc.data = school.teachdesc schoolform.address.data = school.address schoolform.schooltype_id.data = school.schooltype_id schoolform.schooltype_name = school.schooltype.name schoolform.website.data = school.website schoolform.distinguish.data = school.distinguish schoolform.leisure.data = school.leisure schoolform.threashold.data = school.threashold schoolform.partner.data = school.partner schoolform.artsource.data = school.artsource schoolform.feedesc.data = school.feedesc schoolform.longitude.data = school.longitude schoolform.latitude.data = school.latitude schoolform.schoolimages = school.schoolimages schoolform.feature_ids.data = [x.feature_id for x in school.schoolfeatures] schoolform.area_id.choices = g_choices_area schoolform.schooltype_id.choices = g_choices_schooltype schoolform.feature_ids.choices = g_choices_feature return schoolform