Exemplo n.º 1
0
 def post(self, request, *args, **kwargs):
     # Getting the data from the request
     data=json.loads(request.body.decode('utf-8'))
     topic_list=[]
     # Getting the topics from the controller and appending it to the list
     for item in TopicController.GetTopics(Name=data.get('topic_name')):
         topic_list.append(item)
     # Returning the list
     return JsonResponse({'TopicList': topic_list})
Exemplo n.º 2
0
Arquivo: views.py Projeto: 19andt/test
    def post(self, request, *args, **kwargs):
        # Getting the data from the request
        data = json.loads(request.body.decode('utf-8'))
        print(data)

        user_list = []
        # Getting the users from the controller and appending it to the list
        for item in GetUser.get_users(Name=data.get('search_text')):
            user_list.append(item)

        topic_list = []
        # Getting the topics from the controller and appending it to the list
        for item in TopicController.GetTopics(Name=data.get('search_text')):
            topic_list.append(item)
        return JsonResponse({
            'SearchingFor': data.get('search_text'),
            'TopicList': topic_list,
            'UserList': user_list
        })