예제 #1
0
 def json_data(self, instance, default=None):
     """Get a JSON compatible value
     """
     value = self.get(instance)
     if value and self.is_multi_valued():
         return map(api.get_url_info, value)
     elif value and not self.is_multi_valued():
         return api.get_url_info(value)
     return value or default
예제 #2
0
    def json_data(self, instance, default=None):
        """Get a JSON compatible value
        """
        value = self.get(instance)

        out = []
        for rel in value:
            if rel.isBroken():
                logger.warn("Skipping broken relation {}".format(repr(rel)))
                continue
            obj = rel.to_object
            out.append(api.get_url_info(obj))
        return out