示例#1
0
 def user_list_elements(self, **args):
     result = helpers.datatable_helper(self.backend, "User", "name",
                                       ["name", "email"], **args)
     result["aaData"] = [[
         "<a id='%s' href=/admin/user_edit?id=%s>%s</a>" %
         (d["id"], d["id"], d["name"]), d["email"],
         ", ".join([group for group in d["groups"]["values"]])
     ] for d in result["aaData"]]
     return json.dumps(result)
示例#2
0
 def product_list_elements(self, **args):
     result = helpers.datatable_helper(self.backend, "Product", "name",
                                       ["name", "year"], **args)
     result["aaData"] = [[
         "<a id='%s' href=/admin/product_edit?id=%s>%s</a>" %
         (d["id"], d["id"], d["name"]), d["year"],
         ", ".join([director
                    for director in d["directors"]["values"]]), d["units"]
     ] for d in result["aaData"]]
     return json.dumps(result)
示例#3
0
 def comment_list_elements(self, **args):
     result = helpers.datatable_helper(
         self.backend, "Review", "name",
         ["date", "alias", "name", "product_id", "content"], **args)
     result["aaData"] = [[
         d["date"], d["alias"],
         "<a id='%s' href=/admin/comment_edit?id=%s>%s</a>" %
         (d["id"], d["id"], d["name"]), d["product"]["name"], d["content"]
     ] for d in result["aaData"]]
     return json.dumps(result)
示例#4
0
 def ad_list_elements(self, **args):
     result = helpers.datatable_helper(
         self.backend, "Ad", "name",
         ["name", "enabled", "ad_type", "valid_until"], **args)
     result["aaData"] = [[
         "<a id='%s' href=/admin/ad_edit?id=%s>%s</a>" %
         (d["id"], d["id"], d["name"]), d["enabled"] and "si" or "no",
         d["ad_type"]["value"], d["valid_until"]
     ] for d in result["aaData"]]
     return json.dumps(result)
示例#5
0
 def order_list_elements( self, **args ):
   result = helpers.datatable_helper( self.backend, "Order", ["User", "name"], ["date", "user_id", "detail" ], prefilter = [["status", 0]], **args )
   result["aaData"] = [
     [
       d["date"],
       "<a id='%s' href=/admin/order_view?id=%s>%s</a>" % ( d["id"], d["id"],  d["user"]["name"] ),
       ", ".join( [v["product"]["name"] for v in d["detail"]] )
     ]
     for d in result["aaData"]
   ]
   return json.dumps( result )
示例#6
0
 def user_list_elements( self, **args ):
   result = helpers.datatable_helper( self.backend, "User", "name", ["name", "email" ], **args )
   result["aaData"] = [
     [
       "<a id='%s' href=/admin/user_edit?id=%s>%s</a>" % ( d["id"], d["id"],  d["name"] ),
       d["email"],
       ", ".join( [group for group in d["groups"]["values"]] )
     ]
     for d in result["aaData"]
   ]
   return json.dumps( result )
示例#7
0
 def product_list_elements( self, **args ):
   result = helpers.datatable_helper( self.backend, "Product", "name", ["name", "year" ], **args )
   result["aaData"] = [
     [
       "<a id='%s' href=/admin/product_edit?id=%s>%s</a>" % ( d["id"], d["id"],  d["name"] ),
       d["year"],
       ", ".join( [director for director in d["directors"]["values"]] ),
       d["units"]
     ]
     for d in result["aaData"]
   ]
   return json.dumps( result )
示例#8
0
 def ad_list_elements( self, **args ):
   result = helpers.datatable_helper( self.backend, "Ad", "name", ["name", "enabled", "ad_type", "valid_until" ], **args )
   result["aaData"] = [
     [
       "<a id='%s' href=/admin/ad_edit?id=%s>%s</a>" % ( d["id"], d["id"],  d["name"] ),
       d["enabled"] and "si" or "no",
       d["ad_type"]["value"],
       d["valid_until"]
     ]
     for d in result["aaData"]
   ]
   return json.dumps( result )
示例#9
0
 def comment_list_elements( self, **args ):
   result = helpers.datatable_helper( self.backend, "Review", "name", ["date", "alias", "name", "product_id", "content" ], **args )
   result["aaData"] = [
     [
       d["date"],
       d["alias"],
       "<a id='%s' href=/admin/comment_edit?id=%s>%s</a>" % ( d["id"], d["id"],  d["name"] ),
       d["product"]["name"],
       d["content"]
     ]
     for d in result["aaData"]
   ]
   return json.dumps( result )
示例#10
0
 def order_list_elements(self, **args):
     result = helpers.datatable_helper(self.backend,
                                       "Order", ["User", "name"],
                                       ["date", "user_id", "detail"],
                                       prefilter=[["status", 0]],
                                       **args)
     result["aaData"] = [[
         d["date"],
         "<a id='%s' href=/admin/order_view?id=%s>%s</a>" %
         (d["id"], d["id"], d["user"]["name"]),
         ", ".join([v["product"]["name"] for v in d["detail"]])
     ] for d in result["aaData"]]
     return json.dumps(result)