def bugs_to_json_response(data, bunch_of_bugs, callback_function_name=''):
 obj_serializer = serializers.get_serializer('python')()
 bugs = obj_serializer.serialize(bunch_of_bugs)
 for bug in bugs:
  project = Project.objects.get(pk=int(bug['fields']['project']))
  bug['fields']['project'] = project.display_name
 data_list = [{'bugs': bugs}]
 json_as_string = json.dumps(data_list, default=encode_datetime)
 json_string_with_callback = (((callback_function_name + '(') + json_as_string) + ')')
 return HttpResponse(json_string_with_callback)

def bugs_to_json_response ( data , bunch_of_bugs , callback_function_name = '' ) : obj_serializer = serializers . get_serializer ( 'python' ) ( ) bugs = obj_serializer . serialize ( bunch_of_bugs ) for bug in bugs : project = Project . objects . get ( pk = int ( bug [ 'fields' ] [ 'project' ] ) ) bug [ 'fields' ] [ 'project' ] = project . display_name data_list = [ { 'bugs' : bugs } ] json_as_string = json . dumps ( data_list , default = encode_datetime ) json_string_with_callback = ( ( ( callback_function_name + '(' ) + json_as_string ) + ')' ) return HttpResponse ( json_string_with_callback )
the search results page accesses this view via jquerys getjson method .