How to use the wagtailvideos.forms.VideoTranscodeAdminForm 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 / forms.py View on Github external
def __init__(self, video, data=None, **kwargs):
        super(VideoTranscodeAdminForm, self).__init__(data=data, **kwargs)
        self.video = video
github neon-jungle / wagtailvideos / wagtailvideos / views / videos.py View on Github external
def create_transcode(request, video_id):
    if request.method != 'POST':
        return HttpResponseNotAllowed(['POST'])
    video = get_object_or_404(Video, id=video_id)
    transcode_form = VideoTranscodeAdminForm(data=request.POST, video=video)

    if transcode_form.is_valid():
        transcode_form.save()
    return redirect('wagtailvideos:edit', video_id)
github neon-jungle / wagtailvideos / wagtailvideos / views / videos.py View on Github external
if not video._meta.get_field('file').storage.exists(video.file.name):
        # Give error if image file doesn't exist
        messages.error(request, _(
            "The source video file could not be found. Please change the source or delete the video."
        ).format(video.title), buttons=[
            messages.button(reverse('wagtailvideos:delete', args=(video.id,)), _('Delete'))
        ])

    return render(request, "wagtailvideos/videos/edit.html", {
        'video': video,
        'form': form,
        'filesize': video.get_file_size(),
        'can_transcode': ffmpeg.installed(),
        'transcodes': video.transcodes.all(),
        'transcode_form': VideoTranscodeAdminForm(video=video),
        'user_can_delete': permission_policy.user_has_permission_for_instance(request.user, 'delete', video)
    })