import os from journal.models import * from django.contrib.flatpages.models import * def save_page(p): if p.id == 15: return url = p.url.decode('utf-8') f = open("flat_page_dump/" + url.strip("/").replace("/", "_") + ".html", 'w') f.write("Title: " + p.title + "\n") f.write("Url: " + url + "\n") f.write("SaveAs: " + url + "index.html\n") f.write("Date: " + str(p.date)) f.write("\n") f.write("\n") f.write(p.content.decode('utf-8')) f.close() os.system("mkdir flat_page_dump") for page in FlatPage.objects.all(): save_page(page) def save_links(): f = open("link_dump.html", 'w') f.write("\n") f.close() def save_micro(): f = open("micro_dump.html", 'w') f.write("\n") f.close()