Esempio n. 1
0
def upload_video(request):
    if request.POST:
        form = VideoForm(request.POST, request.FILES)
        if form.is_valid():
            video = form.save(commit=False)
            video.save()
            convert_video.delay(video.id)
            return HttpResponseRedirect('/')
    else:
        form = VideoForm()
    return render(request, 'upload_video.html', {'form': form})
Esempio n. 2
0
def upload_video(request):
    if request.POST:
        form = VideoForm(request.POST, request.FILES)
        if form.is_valid():
            video = form.save(commit=False)
            video.save()
            convert_video.delay(video.id)
            return HttpResponseRedirect('/')
    else:
        form = VideoForm()
    return render(request, 'upload_video.html', {
        'form':form
    })
Esempio n. 3
0
    def post(self, request):
        tags = do_the_tags_magic(request.POST.get("tags", ""))
        request.POST["tags"] = tags

        form = VideoForm(request.POST, request.FILES)
        if form.is_valid():
            obj = form.save(commit=False)
            obj.owner = request.user
            obj.save()
            form.save_m2m()
            return HttpResponseRedirect(reverse("accounts:index"))
        else:
            self.context["form"] = form
            return render(request, "app/upload.html", self.context)
Esempio n. 4
0
    def post(self, request):
        tags = do_the_tags_magic(request.POST.get('tags', ''))
        request.POST['tags'] = tags

        form = VideoForm(request.POST, request.FILES)
        if form.is_valid():
            obj = form.save(commit=False)
            obj.owner = request.user
            obj.save()
            form.save_m2m()

            return HttpResponseRedirect(reverse('accounts:index'))
        else:
            context = {'video_upload_form': form}
            return render(request, 'app/upload.html', context)
Esempio n. 5
0
    def post(self, request):
        tags = do_the_tags_magic(request.POST.get('tags', ''))
        request.POST['tags'] = tags

        form = VideoForm(request.POST, request.FILES)
        if form.is_valid():
            obj = form.save(commit=False)
            obj.owner = request.user
            obj.save()
            form.save_m2m()

            return HttpResponseRedirect(reverse('accounts:index'))
        else:
            context = {'video_upload_form': form}
            return render(request, 'app/upload.html', context)
Esempio n. 6
0
def add(request):
	context = {
		'title': 'Add Video',
		'form_action': reverse('videos:add'),
		'submit_label': 'Upload',
	}

	if request.method == 'POST':
		form = VideoForm(request.POST, request.FILES)
		if form.is_valid():
			obj = form.save(commit=False)
			obj.owner = request.user
			obj.save()
			return HttpResponseRedirect(reverse('accounts:index'))
		else:
			context['form'] = form
	else:
		context['form'] = VideoForm()
	
	return render(request, 'app/video.html', context)
Esempio n. 7
0
def add(request):
    context = {
        'title': 'Add Video',
        'form_action': reverse('videos:add'),
        'submit_label': 'Upload',
    }

    if request.method == 'POST':
        form = VideoForm(request.POST, request.FILES)
        if form.is_valid():
            obj = form.save(commit=False)
            obj.owner = request.user
            obj.save()
            return HttpResponseRedirect(reverse('accounts:index'))
        else:
            context['form'] = form
    else:
        context['form'] = VideoForm()

    return render(request, 'app/video.html', context)