Пример #1
0
Файл: views.py Проект: sm2x/vron
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)
Пример #2
0
Файл: views.py Проект: sm2x/vron
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)
Пример #3
0
Файл: views.py Проект: DRGC/vron
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)
Пример #4
0
Файл: views.py Проект: sm2x/vron
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)
Пример #5
0
Файл: views.py Проект: DRGC/vron
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)
Пример #6
0
Файл: views.py Проект: DRGC/vron
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)
Пример #7
0
Файл: views.py Проект: DRGC/vron
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 )
Пример #8
0
Файл: views.py Проект: DRGC/vron
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 )
Пример #9
0
Файл: views.py Проект: sm2x/vron
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)
Пример #10
0
Файл: views.py Проект: sm2x/vron
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)