How to use the wagtailvideos.models.Video.objects.order_by function in wagtailvideos

To help you get started, we’ve selected a few wagtailvideos examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github neon-jungle / wagtailvideos / wagtailvideos / views / chooser.py View on Github external
video.uploaded_by_user = request.user
            video.save()

            # Reindex the video to make sure all tags are indexed
            search_index.insert_or_update_object(video)

            return render_modal_workflow(
                request, None, json_data={
                    'step': 'video_chosen',
                    'result': get_video_json(video)
                }
            )
    else:
        form = VideoForm()

    videos = Video.objects.order_by('title')
    paginator = Paginator(videos, per_page=12)
    page = paginator.get_page(request.GET.get('p'))

    return render_modal_workflow(
        request, 'wagtailvideos/chooser/chooser.html', None,
        template_vars={'videos': page, 'uploadform': form, 'searchform': searchform},
        json_data=get_chooser_js_data()
    )
github neon-jungle / wagtailvideos / wagtailvideos / views / chooser.py View on Github external
def chooser(request):
    VideoForm = get_video_form(Video)
    uploadform = VideoForm()

    videos = Video.objects.order_by('-created_at')

    q = None
    if (
        'q' in request.GET or 'p' in request.GET or 'tag' in request.GET
        or 'collection_id' in request.GET
    ):
        # this request is triggered from search, pagination or 'popular tags';
        # we will just render the results.html fragment
        collection_id = request.GET.get('collection_id')
        if collection_id:
            videos = videos.filter(collection=collection_id)

        searchform = SearchForm(request.GET)
        if searchform.is_valid():
            q = searchform.cleaned_data['q']