def save(self, *args, **kwargs): doc = self.get_dict() self._set_xform(doc) self._set_start_time(doc) self._set_date(doc) self._set_survey_type(doc) set_uuid(self) super(Instance, self).save(*args, **kwargs)
def save(self, *args, **kwargs): set_uuid(self) self._set_id_string() if getattr(settings, 'STRICT', True) and \ not re.search(r"^[\w-]+$", self.id_string): raise XLSFormError("In strict mode, the XForm ID must be a valid slug and contain no spaces.") self._set_title() super(XForm, self).save(*args, **kwargs)
def save(self, *args, **kwargs): if self.xls: survey = create_survey_from_xls(self.xls) self.json = survey.to_json() self.xml = survey.to_xml() self._mark_start_time_boolean() set_uuid(self) self._set_uuid_in_xml() super(DataDictionary, self).save(*args, **kwargs)
def save(self, *args, **kwargs): set_uuid(self) self._set_id_string() if getattr(settings, 'STRICT', True) and \ not re.search(r"^[\w-]+$", self.id_string): raise XLSFormError( "In strict mode, the XForm ID must be a valid slug and contain no spaces." ) self._set_title() super(XForm, self).save(*args, **kwargs)
def save(self, *args, **kwargs): doc = self.get_dict() self._set_xform(doc) if self.xform and not self.xform.downloadable: raise FormInactiveError() self._set_start_time(doc) self._set_date(doc) self._set_survey_type(doc) set_uuid(self) super(Instance, self).save(*args, **kwargs)
def publish_xml_form(xml_file, user, id_string=None): xml = xml_file.read() survey = create_survey_element_from_xml(xml) form_json = survey.to_json() if id_string: dd = DataDictionary.objects.get(user=user, id_string=id_string) dd.xml = xml dd.json = form_json dd._mark_start_time_boolean() set_uuid(dd) dd._set_uuid_in_xml() dd.save() return dd else: dd = DataDictionary(user=user, xml=xml, json=form_json) dd._mark_start_time_boolean() set_uuid(dd) dd._set_uuid_in_xml(file_name=xml_file.name) dd.save() return dd
def _set_uuid(self): if self.xml and not self.uuid: uuid = get_uuid_from_xml(self.xml) if uuid is not None: self.uuid = uuid set_uuid(self)