Skip to content

Instantly share code, notes, and snippets.

@stephenmcd
Created October 13, 2014 20:00
Show Gist options
  • Save stephenmcd/f0673790525f1c40d2ca to your computer and use it in GitHub Desktop.
Save stephenmcd/f0673790525f1c40d2ca to your computer and use it in GitHub Desktop.
Generate a Page Tree in Mezzanine
from mezzanine.pages.models import RichTextPage
def generate_page_tree(per_branch):
for a in range(per_branch):
x = RichTextPage.objects.create(title="Page %s" % a)
for b in range(per_branch):
y = RichTextPage.objects.create(title="Page %s-%s" % (a, b), parent=x)
for c in range(per_branch):
z = RichTextPage.objects.create(title="Page %s-%s-%s" % (a, b, c), parent=y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment