Ejemplo n.º 1
0
    def convert_ids2objects(cls, obj_dict, model):
        """ Convert object IDs from a dictionary to objects if needed.

        Only IDs that belong to relationship field of `model`
        are converted.
        """
        if not model:
            log.info("%s has no model defined" % cls.__name__)
            return

        for field in obj_dict:
            if not engine.is_relationship_field(field, model):
                continue
            rel_model_cls = engine.get_relationship_cls(field, model)
            BaseView.id2obj(obj_dict, field, rel_model_cls)
Ejemplo n.º 2
0
    def convert_ids2objects(self):
        """ Convert object IDs from `self._json_params` to objects if needed.

        Only IDs that belong to relationship field of `self.Model`
        are converted.
        """
        if not self.Model:
            log.info("%s has no model defined" % self.__class__.__name__)
            return

        for field in self._json_params.keys():
            if not engine.is_relationship_field(field, self.Model):
                continue
            rel_model_cls = engine.get_relationship_cls(field, self.Model)
            self.id2obj(field, rel_model_cls)
Ejemplo n.º 3
0
    def convert_ids2objects(self):
        """ Convert object IDs from `self._json_params` to objects if needed.

        Only IDs that belong to relationship field of `self.Model`
        are converted.
        """
        if not self.Model:
            log.info("%s has no model defined" % self.__class__.__name__)
            return

        for field in self._json_params.keys():
            if not engine.is_relationship_field(field, self.Model):
                continue
            rel_model_cls = engine.get_relationship_cls(field, self.Model)
            self.id2obj(field, rel_model_cls)