1 2 3 4 5 6 7 8 9 10 11 12 13 14
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.core.management import BaseCommand from esolportal.embeddedvideo.models import EmbeddedVideo class Command(BaseCommand): def handle(self, *args, **options): for o in EmbeddedVideo.objects.filter(embed_url__contains='youtube.com'): o.embed_url = o.embed_url.replace('http://www.youtube.com', 'https://www.youtube.com') print('Fixed %s' % o.embed_url) o.save()
You can clone a snippet to your computer for local editing. Learn more.