-
-
Save rlskoeser/757d6a1e412f24be6f894a6e7f218a1d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# check_migrated_block | |
import csv | |
import os | |
import django | |
os.environ["DJANGO_SETTINGS_MODULE"] = "cdhweb.settings" | |
django.setup() | |
from cdhweb.pages.models import ContentPage, LandingPage | |
from cdhweb.events.models import Event | |
from cdhweb.projects.models import Project | |
from cdhweb.people.models import Profile | |
output = "migrated_content.csv" | |
csvfile = open(output, "w") | |
print(f"saving report to {output}") | |
csvwriter = csv.writer(csvfile) | |
csvwriter.writerow(["page_type", "url", "title"]) | |
pagetypes = { | |
"event": Event, | |
"contentpage": ContentPage, | |
"landingpage": LandingPage, | |
"project": Project, | |
"profile": Profile, | |
} | |
for pagetype, cls in pagetypes.items(): | |
print(f"checking {pagetype}") | |
for page in cls.objects.live(): | |
if "migrated" in [b.block_type for b in page.body]: | |
csvwriter.writerow([pagetype, page.full_url, page.title]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment