Snippets

eSolution fix_elabor_oembed.py

Created by Istvan Farkas last modified
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.core.management import BaseCommand

from video.models import Video


class Command(BaseCommand):
    def handle(self, *args, **options):
        for o in Video.objects.filter(embed_url__contains='youtube.com'):
            o.embed_url = o.embed_url.replace('http://www.youtube.com', 'https://www.youtube.com').replace('http://youtube.com', 'https://youtube.com')
            print('Fixed %s' % o.embed_url)
            o.save()

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.