Exemple #1
0
 def _column_ids_to_db(self, ids):
     """Translate string-based ids to DB-based RegistrationFormItem ids."""
     result = []
     personal_data_field_ids = {x.personal_data_type: x.id for x in self.regform.form_items if x.is_field}
     for item_id in ids:
         if isinstance(item_id, str):
             personal_data_type = PersonalDataType.get(item_id)
             if personal_data_type:
                 item_id = personal_data_field_ids[personal_data_type]
         result.append(item_id)
     return result
Exemple #2
0
 def _column_ids_to_db(self, ids):
     """Translate string-based ids to DB-based RegistrationFormItem ids."""
     result = []
     personal_data_field_ids = {x.personal_data_type: x.id for x in self.regform.form_items if x.is_field}
     for item_id in ids:
         if isinstance(item_id, basestring):
             personal_data_type = PersonalDataType.get(item_id)
             if personal_data_type:
                 item_id = personal_data_field_ids[personal_data_type]
         result.append(item_id)
     return result
Exemple #3
0
 def _column_ids_to_db(self, ids):
     """Translate string-based ids to DB-based RegistrationFormItem ids."""
     result = []
     for item_id in ids:
         if isinstance(item_id, basestring):
             personal_data = PersonalDataType.get(item_id)
             if personal_data:
                 result.append(RegistrationFormPersonalDataField.find_one(registration_form=self.regform,
                                                                          personal_data_type=personal_data).id)
             else:
                 result.append(item_id)
         else:
             result.append(item_id)
     return result
Exemple #4
0
def _column_ids_to_db(form, ids):
    """Translate string-based ids to DB-based RegistrationFormItem ids."""
    result = []
    for item_id in ids:
        if isinstance(item_id, basestring):
            personal_data = PersonalDataType.get(item_id)
            if personal_data:
                result.append(RegistrationFormPersonalDataField.find_one(registration_form=form,
                                                                         personal_data_type=personal_data).id)
            else:
                result.append(item_id)
        else:
            result.append(item_id)
    return result