示例#1
0
 def get_names(self):
     names = ContentView.autocomplete("name",
                                      self.request.matchdict["complete"])
     return {
         "data": names,
         "links": {
             "came_from": self.came_from,
             "url": self.url,
         },
         "message": "Name completions retrieved successfully."
     }
示例#2
0
 def get_keywords(self):
     if self.request.matchdict.get("complete"):
         keywords = ContentView.autocomplete(
             "keyword", self.request.matchdict["complete"])
         response = {
             "message": "Keyword completions retrieved successfully."
         }
     else:
         keywords = ContentView.get_parts(
             content_part="keyword", page_num=self.request.data["page_num"])
         response = {"message": "Keywords retrieved successfully."}
     response.update({
         "data": keywords,
         "links": {
             "came_from": self.came_from,
             "url": self.url,
         },
     })
     return response