def handle(self, *args, **options): response_search = bitly.search({"query": "", "location": ""}) link_objects = Link.objects.all() urls = [] for link_obj in link_objects: urls.append(link_obj.url) self._create_tags(urls)
def search(request): user_input = {} user_input['query'] = request.POST['query'] user_input['location'] = request.POST['location'] response = bitly.search(user_input) c = { 'response': response, 'show_response': True, 'response_found': len(response['data']['results']) > 0 } return render_to_response('index.html', c, context_instance=RequestContext(request))
def post(self): user_input = {} user_input['query'] = self.request.get('query') user_input['location'] = self.request.get('location') response = bitly.search(user_input) template_values = { 'response': response, 'show_response': True, 'response_found': len(response['data']['results']) > 0 } template = JINJA_ENVIRONMENT.get_template('index.html') self.response.write(template.render(template_values))