Beispiel #1
0
def key_list_json(request):
    """
    Generates JSON for the listing (required for the JS plugin www.datatables.net)

    :param: request
    :return: String
    """

    # Searches DB records
    objects = Key.objects.filter()

    # Gets base key to prepend to all keys
    config = get_object_or_false(Config, pk=settings.ID_CONFIG_BASE_API_KEY)
    base_key = config.value

    # settings
    info = {
        'fields_to_select': ['id', 'name'],
        'fields_to_search': ['id', 'name', 'comments'],
        'default_order_by': 'id',
        'url_base_name': 'key',
        'namespace': 'admin:connector:',
        'prepend': {
            'name': base_key
        }
    }

    # Builds json data and return it to the screen
    json = build_datatable_json(request, objects, info)
    return HttpResponse(json)
Beispiel #2
0
def log_list_json(request):
    """
    Generates JSON for the listing (required for the JS plugin www.datatables.net)

    :param: request
    :return: String
    """

    # Searches DB records
    objects = Log.get_listing()

    # settings
    info = {
        'fields_to_select':
        ['id', 'modified_date', 'external_reference', 'log_status.name'],
        'fields_to_search': [
            'id', 'external_reference', 'error_message',
            'ron_confirmation_number'
        ],
        'default_order_by':
        'id',
        'url_base_name':
        'log',
        'namespace':
        'admin:connector:'
    }

    # Builds json data and return it to the screen
    json = build_datatable_json(request, objects, info, ['delete'])
    return HttpResponse(json)
Beispiel #3
0
def key_list_json(request):
    """
    Generates JSON for the listing (required for the JS plugin www.datatables.net)

    :param: request
    :return: String
    """

    # Searches DB records
    objects = Key.objects.filter()

    # Gets base key to prepend to all keys
    config = get_object_or_false(Config, pk=settings.ID_CONFIG_BASE_API_KEY)
    base_key = config.value

    # settings
    info = {
        "fields_to_select": ["id", "name"],
        "fields_to_search": ["id", "name", "comments"],
        "default_order_by": "id",
        "url_base_name": "key",
        "namespace": "admin:connector:",
        "prepend": {"name": base_key},
    }

    # Builds json data and return it to the screen
    json = build_datatable_json(request, objects, info)
    return HttpResponse(json)
Beispiel #4
0
def config_list_json(request):
    """
    Generates JSON for the listing (required for the JS plugin www.datatables.net)

    :param: request
    :return: String
    """

    # Query data
    objects = Config.objects.filter()

    # settings
    info = {
        'fields_to_select': ['id', 'name', 'value'],
        'fields_to_search': ['id', 'name', 'value'],
        'default_order_by': 'id',
        'url_base_name': 'config',
        'namespace': 'admin:connector:'
    }

    # Builds json data and return it to the screen
    json = build_datatable_json(request, objects, info)
    return HttpResponse(json)
Beispiel #5
0
def config_list_json(request):
    """
    Generates JSON for the listing (required for the JS plugin www.datatables.net)

    :param: request
    :return: String
    """

    # Query data
    objects = Config.objects.filter()

    # settings
    info = {
        "fields_to_select": ["id", "name", "value"],
        "fields_to_search": ["id", "name", "value"],
        "default_order_by": "id",
        "url_base_name": "config",
        "namespace": "admin:connector:",
    }

    # Builds json data and return it to the screen
    json = build_datatable_json(request, objects, info)
    return HttpResponse(json)
Beispiel #6
0
def log_list_json(request):
    """
    Generates JSON for the listing (required for the JS plugin www.datatables.net)

    :param: request
    :return: String
    """

    # Searches DB records
    objects = Log.get_listing()

    # settings
    info = {
        "fields_to_select": ["id", "modified_date", "external_reference", "log_status.name"],
        "fields_to_search": ["id", "external_reference", "error_message", "ron_confirmation_number"],
        "default_order_by": "id",
        "url_base_name": "log",
        "namespace": "admin:connector:",
    }

    # Builds json data and return it to the screen
    json = build_datatable_json(request, objects, info, ["delete"])
    return HttpResponse(json)
Beispiel #7
0
def admin_user_list_json( request ):
    """
    Generates JSON for the listing (required for the JS plugin www.datatables.net)

    :param: request
    :return: String
    """

    # Query data
    user = get_user_model()
    objects = user.objects.filter( is_admin = True )

    # settings
    info = {
        'fields_to_select': [ 'id', 'name', 'email', 'is_superuser' ],
        'fields_to_search': [ 'id', 'name', 'email', 'is_superuser' ],
        'default_order_by': 'id',
        'url_base_name': 'admin_user',
        'namespace': 'admin:core:'
    }

    #build json data and return it to the screen
    json = build_datatable_json( request, objects, info )
    return HttpResponse( json )
Beispiel #8
0
def group_list_json( request ):
    """
    Generates JSON for the listing (required for the JS plugin www.datatables.net)

    :param: request
    :return: String
    """

    # Query data
    #group = Group()
    objects = Group.objects.all()

    # settings
    info = {
        'fields_to_select': [ 'id', 'name' ],
        'fields_to_search': [ 'id', 'name' ],
        'default_order_by': 'name',
        'url_base_name': 'group',
        'namespace': 'admin:core:',
    }

    #build json data and return it to the screen
    json = build_datatable_json( request, objects, info )
    return HttpResponse( json )
Beispiel #9
0
def admin_user_list_json(request):
    """
    Generates JSON for the listing (required for the JS plugin www.datatables.net)

    :param: request
    :return: String
    """

    # Query data
    user = get_user_model()
    objects = user.objects.filter(is_admin=True)

    # settings
    info = {
        'fields_to_select': ['id', 'name', 'email', 'is_superuser'],
        'fields_to_search': ['id', 'name', 'email', 'is_superuser'],
        'default_order_by': 'id',
        'url_base_name': 'admin_user',
        'namespace': 'admin:core:'
    }

    #build json data and return it to the screen
    json = build_datatable_json(request, objects, info)
    return HttpResponse(json)
Beispiel #10
0
def group_list_json(request):
    """
    Generates JSON for the listing (required for the JS plugin www.datatables.net)

    :param: request
    :return: String
    """

    # Query data
    #group = Group()
    objects = Group.objects.all()

    # settings
    info = {
        'fields_to_select': ['id', 'name'],
        'fields_to_search': ['id', 'name'],
        'default_order_by': 'name',
        'url_base_name': 'group',
        'namespace': 'admin:core:',
    }

    #build json data and return it to the screen
    json = build_datatable_json(request, objects, info)
    return HttpResponse(json)