django_youtube/views.py
def upload_return(request):
    """
    The upload result page
    Youtube will redirect to this page after upload is finished
    Saves the video data and redirects to the next page

    Params:
        status: status of the upload (200 for success)
        id: id number of the video
    """
    status = request.GET.get("status")
    video_id = request.GET.get("id")

    if status == "200" and video_id:
        # upload is successful

        # save the video entry
        video = Video()
        video.user = request.user
        video.video_id = video_id
        video.save()

        # send a signal
        video_created.send(sender=video, video=video)

        # Redirect to the video page or the specified page
        try:
            next_url = settings.YOUTUBE_UPLOAD_REDIRECT_URL
        except AttributeError:
            next_url = reverse(
                "django_youtube.views.video", kwargs={"video_id": video_id})

        return HttpResponseRedirect(next_url)
    else:
        # upload failed, redirect to upload page
        from django.contrib import messages
        messages.add_message(
            request, messages.ERROR, _('Upload failed, Please try again.'))
        return HttpResponseRedirect(reverse("django_youtube.views.upload"))
def upload_return(request):
    """
    The upload result page
    Youtube will redirect to this page after upload is finished
    Saves the video data and redirects to the next page

    Params:
        status: status of the upload (200 for success)
        id: id number of the video
    """
    status = request.GET.get("status")
    video_id = request.GET.get("id")

    if status == "200" and video_id:
        # upload is successful

        # save the video entry
        video = Video()
        video.user = request.user
        video.video_id = video_id
        video.save()

        # send a signal
        video_created.send(sender=video, video=video)

        # Redirect to the video page or the specified page
        try:
            next_url = settings.YOUTUBE_UPLOAD_REDIRECT_URL
        except AttributeError:
            next_url = reverse(
                "django_youtube.views.video", kwargs={"video_id": video_id})

        return HttpResponseRedirect(next_url)
    else:
        # upload failed, redirect to upload page
        from django.contrib import messages
        messages.add_message(
            request, messages.ERROR, _('Upload failed, Please try again.'))
        return HttpResponseRedirect(reverse("django_youtube.views.upload"))
def upload_return ( request ) : status = request . GET . get ( "status" ) video_id = request . GET . get ( "id" ) if status == "200" and video_id : # upload is successful # save the video entry video = Video ( ) video . user = request . user video . video_id = video_id video . save ( ) # send a signal video_created . send ( sender = video , video = video ) # Redirect to the video page or the specified page try : next_url = settings . YOUTUBE_UPLOAD_REDIRECT_URL except AttributeError : next_url = reverse ( "django_youtube.views.video" , kwargs = { "video_id" : video_id } ) return HttpResponseRedirect ( next_url ) else : # upload failed, redirect to upload page from django . contrib import messages messages . add_message ( request , messages . ERROR , _ ( 'Upload failed, Please try again.' ) ) return HttpResponseRedirect ( reverse ( "django_youtube.views.upload" ) )
The upload result page
    Youtube will redirect to this page after upload is finished
    Saves the video data and redirects to the next page

    Params:
        status: status of the upload (200 for success)
        id: id number of the video
The upload result page Youtube will redirect to this page after upload is finished Saves the video data and redirects to the next page