Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def migrate_news_image():
- from city.models import News
- a = News.objects.all()
- for i in a:
- for j in i.content:
- if j.type == "IMAGES":
- print(j.value)
- urls = j.value.split('.')
- photo_url = urls[-2]
- urls[-2] = process_image(photo_url)
- url = '.'.join(urls)
- j.value= url
- i.save()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement