Example #1
0
def ajax_change_video_title(request):
    from videos.tasks import send_change_title_email

    video_id = request.POST.get('video_id')
    title = request.POST.get('title')
    user = request.user

    try:
        video = Video.objects.get(video_id=video_id)
        if title and not video.title or video.is_html5() or user.is_superuser:
            old_title = video.title_display()
            video.title = title
            video.slug = slugify(video.title)
            video.save()
            action = Action(new_video_title=video.title, video=video)
            action.user = user.is_authenticated() and user or None
            action.created = datetime.now()
            action.action_type = Action.CHANGE_TITLE
            action.save()

            send_change_title_email.delay(video.id, user and user.id,
                                          old_title, video.title)
    except Video.DoesNotExist:
        pass

    return HttpResponse('')
Example #2
0
def ajax_change_video_title(request):
    from videos.tasks import send_change_title_email
    
    video_id = request.POST.get('video_id')
    title = request.POST.get('title')
    user = request.user
    
    try:
        video = Video.objects.get(video_id=video_id)
        if title and not video.title or video.is_html5() or user.is_superuser:
            old_title = video.title_display()
            video.title = title
            video.slug = slugify(video.title)
            video.save()
            action = Action(new_video_title=video.title, video=video)
            action.user = user.is_authenticated() and user or None
            action.created = datetime.now()
            action.action_type = Action.CHANGE_TITLE
            action.save()
            
            send_change_title_email.delay(video.id, user and user.id, old_title, video.title)          
    except Video.DoesNotExist:
        pass
    
    return HttpResponse('')
Example #3
0
def ajax_change_video_title(request):
    video_id = request.POST.get("video_id")
    title = request.POST.get("title")
    user = request.user

    try:
        video = Video.objects.get(video_id=video_id)
        if title and not video.title or video.is_html5() or user.is_superuser:
            old_title = video.title_display()
            video.title = title
            video.slug = slugify(video.title)
            video.save()
            action = Action(new_video_title=video.title, video=video)
            action.user = user.is_authenticated() and user or None
            action.created = datetime.now()
            action.action_type = Action.CHANGE_TITLE
            action.save()

            users = video.notification_list(user)

            for obj in users:
                subject = u"Video's title changed on Universal Subtitles"
                context = {
                    "user": obj,
                    "domain": Site.objects.get_current().domain,
                    "video": video,
                    "editor": user,
                    "old_title": old_title,
                    "hash": obj.hash_for_video(video.video_id),
                }
                send_templated_email(
                    obj.email,
                    subject,
                    "videos/email_title_changed.html",
                    context,
                    "*****@*****.**",
                    fail_silently=not settings.DEBUG,
                )
    except Video.DoesNotExist:
        pass

    return HttpResponse("")
Example #4
0
def ajax_change_video_title(request):
    video_id = request.POST.get('video_id')
    title = request.POST.get('title')
    user = request.user

    try:
        video = Video.objects.get(video_id=video_id)
        if title and not video.title or video.is_html5() or user.is_superuser:
            old_title = video.title_display()
            video.title = title
            video.slug = slugify(video.title)
            video.save()
            action = Action(new_video_title=video.title, video=video)
            action.user = user.is_authenticated() and user or None
            action.created = datetime.now()
            action.action_type = Action.CHANGE_TITLE
            action.save()

            users = video.notification_list(user)

            for obj in users:
                subject = u'Video\'s title changed on Universal Subtitles'
                context = {
                    'user': obj,
                    'domain': Site.objects.get_current().domain,
                    'video': video,
                    'editor': user,
                    'old_title': old_title,
                    'hash': obj.hash_for_video(video.video_id)
                }
                send_templated_email(obj.email,
                                     subject,
                                     'videos/email_title_changed.html',
                                     context,
                                     '*****@*****.**',
                                     fail_silently=not settings.DEBUG)
    except Video.DoesNotExist:
        pass

    return HttpResponse('')
Example #5
0
def ajax_change_video_title(request):
    video_id = request.POST.get('video_id')
    title = request.POST.get('title')
    user = request.user
    
    try:
        video = Video.objects.get(video_id=video_id)
        if title and not video.title or video.is_html5() or user.is_superuser:
            old_title = video.title_display()
            video.title = title
            video.slug = slugify(video.title)
            video.save()
            action = Action(new_video_title=video.title, video=video)
            action.user = user.is_authenticated() and user or None
            action.created = datetime.now()
            action.action_type = Action.CHANGE_TITLE
            action.save()
            
            users = video.notification_list(user)
            
            for obj in users:
                subject = u'Video\'s title changed on Universal Subtitles'
                context = {
                    'user': obj,
                    'domain': Site.objects.get_current().domain,
                    'video': video,
                    'editor': user,
                    'old_title': old_title,
                    'hash': obj.hash_for_video(video.video_id)
                }
                send_templated_email(obj.email, subject, 
                                     'videos/email_title_changed.html',
                                     context, '*****@*****.**',
                                     fail_silently=not settings.DEBUG)            
    except Video.DoesNotExist:
        pass
    
    return HttpResponse('')