web/views/json.py
branchstable
changeset 8657 5ab6ec83d5ba
parent 8651 353bbd17a8b6
child 8694 d901c36bcfce
--- a/web/views/json.py	Tue Jan 15 20:17:09 2013 +0100
+++ b/web/views/json.py	Fri Jan 18 17:37:35 2013 +0100
@@ -111,7 +111,12 @@
     title = _('json-entities-export-view')
 
     def call(self):
-        if self.cw_rset is None:
-            self.wdata([self.cw_extra_kwargs.get('entity')])
-        else:
-            self.wdata(list(self.cw_rset.entities()))
+        entities = []
+        for entity in self.cw_rset.entities():
+            entity.complete() # fetch all attributes
+            # hack to add extra metadata
+            entity.cw_attr_cache.update({
+                    '__cwetype__': entity.__regid__,
+                    })
+            entities.append(entity)
+        self.wdata(entities)