コード例 #1
0
def update_video_external_url(apps, schema_editor):
    PageAsset = apps.get_model('common', 'PageAsset')
    for page_asset in PageAsset.objects.all():
        if page_asset.vimeo_video_code:
            page_asset.video_external_url = get_external_url(
                page_asset.vimeo_video_code)
            page_asset.save()
コード例 #2
0
def update_external_url(sender, instance, **kwargs):
    if instance.vimeo_video_code and instance.pk:
        vimeo_video_code_changed = PageAsset.objects.get(
            id=instance.id).vimeo_video_code != instance.vimeo_video_code
        if vimeo_video_code_changed:
            instance.video_external_url = get_external_url(
                instance.vimeo_video_code)
コード例 #3
0
 def handle(self, *args, **options):
     gallery_videos = SharedVideo.objects.exclude(
         Q(video_id__exact='') | Q(video_id__isnull=True)).filter(
             Q(video_external_url__exact='')
             | Q(video_external_url__isnull=True))
     for video in gallery_videos:
         video.video_external_url = get_external_url(video.video_id)
         if video.video_external_url:
             video.completed = True
         video.save()
コード例 #4
0
def set_external_url(sender, instance, created, **kwargs):
    if created and instance.vimeo_video_code:
        instance.video_external_url = get_external_url(
            instance.vimeo_video_code)
        instance.save()
コード例 #5
0
def update_video_external_url(apps, schema_editor):
    SharedVideo = apps.get_model('owners_portal', 'SharedVideo')
    for video in SharedVideo.objects.all():
        if video.video_id:
            video.video_external_url = get_external_url(video.video_id)
            video.save()
コード例 #6
0
 def handle(self, *args, **options):
     for video in Video.objects.all():
         if video.vimeo_video_code:
             video.video_external_url = get_external_url(
                 video.vimeo_video_code)
             video.save()