Ejemplo n.º 1
0
def media_addexisting_ajax_partial(request):
    """
    This renders the partial template for adding files that are
    currently in the sites media library
    """
    current_file_pks = [int(x) for x in request.GET.getlist('files')]

    search_text = request.GET.get('search_text')

    if search_text:
        media_files = MediaFile.objects.filter(title__icontains=search_text)
    else:
        media_files = MediaFile.objects.all()

    media_files = media_files.exclude(
        pk__in=current_file_pks).order_by('-created')
    page = request.GET.get('page', 1)

    media_files = get_number_paginator(media_files, page=page, per_page=12)

    page_data = {
        'page': media_files,
    }

    return render(
        request,
        'media/media/addexisting_ajax_partial.html',
        page_data
    )
Ejemplo n.º 2
0
def media_list(request):
    '''
    Admin page for list of all media.
    '''
    page = request.GET.get('page', 1)
    search_text = request.GET.get('search_text')

    if request.GET.get('partial'):
        template = 'media/media/list_partial.html'
    else:
        template = 'media/media/list.html'

    if search_text:
        media_files = MediaFile.objects.filter(title__icontains=search_text)
    else:
        media_files = MediaFile.objects.all()

    media_files = media_files.order_by('-created')
    media_files = get_number_paginator(media_files, per_page=18, page=page)

    page_data = {
        'page': media_files,
    }

    return render(request, template, page_data)
Ejemplo n.º 3
0
def media_addexisting_ajax_partial(request):
    """
    This renders the partial template for adding files that are
    currently in the sites media library
    """
    current_file_pks = [int(x) for x in request.GET.getlist('files')]

    search_text = request.GET.get('search_text')

    if search_text:
        media_files = MediaFile.objects.filter(title__icontains=search_text)
    else:
        media_files = MediaFile.objects.all()

    media_files = media_files.exclude(
        pk__in=current_file_pks).order_by('-created')
    page = request.GET.get('page', 1)

    media_files = get_number_paginator(media_files, page=page, per_page=12)

    page_data = {
        'page': media_files,
    }

    return render(request, 'media/media/addexisting_ajax_partial.html',
                  page_data)
Ejemplo n.º 4
0
def media_list(request):
    '''
    Admin page for list of all media.
    '''
    page = request.GET.get('page', 1)
    search_text = request.GET.get('search_text')

    if request.GET.get('partial'):
        template = 'media/media/list_partial.html'
    else:
        template = 'media/media/list.html'

    if search_text:
        media_files = MediaFile.objects.filter(title__icontains=search_text)
    else:
        media_files = MediaFile.objects.all()

    media_files = media_files.order_by('-created')
    media_files = get_number_paginator(media_files, per_page=18, page=page)

    page_data = {
        'page': media_files,
    }

    return render(request, template, page_data)
Ejemplo n.º 5
0
def image_gallery_list(request):
    '''
    Admin page for listing image galleries
    '''
    page = request.GET.get('page', 1)
    image_galleries = ImageGallery.objects.all()

    image_galleries = get_number_paginator(image_galleries, page=page)

    page_data = {
        'image_galleries': image_galleries,
    }

    return render(request, 'media/image_gallery/list.html', page_data)
Ejemplo n.º 6
0
def image_gallery_list(request):
    '''
    Admin page for listing image galleries
    '''
    page = request.GET.get('page', 1)
    image_galleries = ImageGallery.objects.all()

    image_galleries = get_number_paginator(image_galleries, page=page)

    page_data = {
        'image_galleries': image_galleries,
    }

    return render(request, 'media/image_gallery/list.html', page_data)