Skip to content

Instantly share code, notes, and snippets.

@marufsiddiqui
Last active December 26, 2015 23:39
Show Gist options
  • Select an option

  • Save marufsiddiqui/7231923 to your computer and use it in GitHub Desktop.

Select an option

Save marufsiddiqui/7231923 to your computer and use it in GitHub Desktop.
if __name__ == "__main__":
website = raw_input("Enter website name: ")
ws = Website.objects.get(subdomain=website)
print "you entered ", ws.name
page = raw_input("Enter page urls, comma separated for multiple pages: ")
pg = Page.objects.get(url=page,website=ws)
print "you entered ", pg
modules = raw_input("Enter module type and block comma separated for multiple modules: ")
print "you entered ", modules
for mod_block in modules.split(','):
module_type, block = mod_block.split(':')
Module.objects.get_or_create(
title=module_type,
block=block,
order=2,
page=pg,
module_type=module_type,
is_published=False,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment