(request, option)
Generate the jtable data for rendering in the list template.

    :param request: The request for this jtable.
    :type request: :class:`django.http.HttpRequest`
    :param option: Action to take.
    :type option: str of either 'jtlist', 'jtdelete', or 'inline'.
    :returns: :class:`django.http.HttpResponse`
Generate the jtable data for rendering in the list template.
Generate the jtable data for rendering in the list template .
def generate_raw_data_jtable(request, option):
    """
    Generate the jtable data for rendering in the list template.

    :param request: The request for this jtable.
    :type request: :class:`django.http.HttpRequest`
    :param option: Action to take.
    :type option: str of either 'jtlist', 'jtdelete', or 'inline'.
    :returns: :class:`django.http.HttpResponse`
    """

    obj_type = RawData
    type_ = "raw_data"
    mapper = obj_type._meta['jtable_opts']
    if option == "jtlist":
        # Sets display url
        details_url = mapper['details_url']
        details_url_key = mapper['details_url_key']
        fields = mapper['fields']
        response = jtable_ajax_list(obj_type,
                                    details_url,
                                    details_url_key,
                                    request,
                                    includes=fields)
        return HttpResponse(json.dumps(response,
                                       default=json_handler),
                            content_type="application/json")
    if option == "jtdelete":
        response = {"Result": "ERROR"}
        if jtable_ajax_delete(obj_type,request):
            response = {"Result": "OK"}
        return HttpResponse(json.dumps(response,
                                       default=json_handler),
                            content_type="application/json")
    jtopts = {
        'title': "Raw Data",
        'default_sort': mapper['default_sort'],
        'listurl': reverse('crits-%s-views-%s_listing' % (type_,
                                                            type_),
                           args=('jtlist',)),
        'deleteurl': reverse('crits-%s-views-%s_listing' % (type_,
                                                              type_),
                             args=('jtdelete',)),
        'searchurl': reverse(mapper['searchurl']),
        'fields': mapper['jtopts_fields'],
        'hidden_fields': mapper['hidden_fields'],
        'linked_fields': mapper['linked_fields'],
        'details_link': mapper['details_link'],
        'no_sort': mapper['no_sort']
    }
    jtable = build_jtable(jtopts,request)
    jtable['toolbar'] = [
        {
            'tooltip': "'All Raw Data'",
            'text': "'All'",
            'click': "function () {$('#raw_data_listing').jtable('load', {'refresh': 'yes'});}",
            'cssClass': "'jtable-toolbar-center'",
        },
        {
            'tooltip': "'New Raw Data'",
            'text': "'New'",
            'click': "function () {$('#raw_data_listing').jtable('load', {'refresh': 'yes', 'status': 'New'});}",
            'cssClass': "'jtable-toolbar-center'",
        },
        {
            'tooltip': "'In Progress Raw Data'",
            'text': "'In Progress'",
            'click': "function () {$('#raw_data_listing').jtable('load', {'refresh': 'yes', 'status': 'In Progress'});}",
            'cssClass': "'jtable-toolbar-center'",
        },
        {
            'tooltip': "'Analyzed Raw Data'",
            'text': "'Analyzed'",
            'click': "function () {$('#raw_data_listing').jtable('load', {'refresh': 'yes', 'status': 'Analyzed'});}",
            'cssClass': "'jtable-toolbar-center'",
        },
        {
            'tooltip': "'Deprecated Raw Data'",
            'text': "'Deprecated'",
            'click': "function () {$('#raw_data_listing').jtable('load', {'refresh': 'yes', 'status': 'Deprecated'});}",
            'cssClass': "'jtable-toolbar-center'",
        },
        {
            'tooltip': "'Add Raw Data'",
            'text': "'Add Raw Data'",
            'click': "function () {$('#new-raw-data').click()}",
        },
    ]

    if option == "inline":
        return render(request, "jtable.html",
                                  {'jtable': jtable,
                                   'jtid': '%s_listing' % type_,
                                   'button' : '%s_tab' % type_})
    else:
        return render(request, "%s_listing.html" % type_,
                                  {'jtable': jtable,
                                   'jtid': '%s_listing' % type_})
def generate_raw_data_jtable ( request , option ) : obj_type = RawData type_ = "raw_data" mapper = obj_type . _meta [ 'jtable_opts' ] if option == "jtlist" : # Sets display url details_url = mapper [ 'details_url' ] details_url_key = mapper [ 'details_url_key' ] fields = mapper [ 'fields' ] response = jtable_ajax_list ( obj_type , details_url , details_url_key , request , includes = fields ) return HttpResponse ( json . dumps ( response , default = json_handler ) , content_type = "application/json" ) if option == "jtdelete" : response = { "Result" : "ERROR" } if jtable_ajax_delete ( obj_type , request ) : response = { "Result" : "OK" } return HttpResponse ( json . dumps ( response , default = json_handler ) , content_type = "application/json" ) jtopts = { 'title' : "Raw Data" , 'default_sort' : mapper [ 'default_sort' ] , 'listurl' : reverse ( 'crits-%s-views-%s_listing' % ( type_ , type_ ) , args = ( 'jtlist' , ) ) , 'deleteurl' : reverse ( 'crits-%s-views-%s_listing' % ( type_ , type_ ) , args = ( 'jtdelete' , ) ) , 'searchurl' : reverse ( mapper [ 'searchurl' ] ) , 'fields' : mapper [ 'jtopts_fields' ] , 'hidden_fields' : mapper [ 'hidden_fields' ] , 'linked_fields' : mapper [ 'linked_fields' ] , 'details_link' : mapper [ 'details_link' ] , 'no_sort' : mapper [ 'no_sort' ] } jtable = build_jtable ( jtopts , request ) jtable [ 'toolbar' ] = [ { 'tooltip' : "'All Raw Data'" , 'text' : "'All'" , 'click' : "function () {$('#raw_data_listing').jtable('load', {'refresh': 'yes'});}" , 'cssClass' : "'jtable-toolbar-center'" , } , { 'tooltip' : "'New Raw Data'" , 'text' : "'New'" , 'click' : "function () {$('#raw_data_listing').jtable('load', {'refresh': 'yes', 'status': 'New'});}" , 'cssClass' : "'jtable-toolbar-center'" , } , { 'tooltip' : "'In Progress Raw Data'" , 'text' : "'In Progress'" , 'click' : "function () {$('#raw_data_listing').jtable('load', {'refresh': 'yes', 'status': 'In Progress'});}" , 'cssClass' : "'jtable-toolbar-center'" , } , { 'tooltip' : "'Analyzed Raw Data'" , 'text' : "'Analyzed'" , 'click' : "function () {$('#raw_data_listing').jtable('load', {'refresh': 'yes', 'status': 'Analyzed'});}" , 'cssClass' : "'jtable-toolbar-center'" , } , { 'tooltip' : "'Deprecated Raw Data'" , 'text' : "'Deprecated'" , 'click' : "function () {$('#raw_data_listing').jtable('load', {'refresh': 'yes', 'status': 'Deprecated'});}" , 'cssClass' : "'jtable-toolbar-center'" , } , { 'tooltip' : "'Add Raw Data'" , 'text' : "'Add Raw Data'" , 'click' : "function () {$('#new-raw-data').click()}" , } , ] if option == "inline" : return render ( request , "jtable.html" , { 'jtable' : jtable , 'jtid' : '%s_listing' % type_ , 'button' : '%s_tab' % type_ } ) else : return render ( request , "%s_listing.html" % type_ , { 'jtable' : jtable , 'jtid' : '%s_listing' % type_ } )