本文整理汇总了Python中models.Page.update方法的典型用法代码示例。如果您正苦于以下问题:Python Page.update方法的具体用法?Python Page.update怎么用?Python Page.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Page
的用法示例。
在下文中一共展示了Page.update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_page_post
# 需要导入模块: from models import Page [as 别名]
# 或者: from models.Page import update [as 别名]
def create_page_post(context, request):
data = request.POST
page = Page(data['title'])
page.layout_template = u'master.html'
for behaviour in data.getall('behaviour'):
page.update(behaviour, data, behaviour + '.')
context[data['uid']] = page
location = model_url(page, request)
return HTTPFound(location = location)
示例2: rebuild
# 需要导入模块: from models import Page [as 别名]
# 或者: from models.Page import update [as 别名]
def rebuild(wipe_sysgen=False):
'''
Designed to be run from shell.
Will wipe DB and load data from file system.
'''
url_list = []
for root, dirs, files in os.walk(PAGE_PATH):
head = root.replace(PAGE_PATH, '')
path = head.split(os.sep)
for file in files:
url = '/'.join(path + [file])
if url[-1:] == '_':
url = url[:-1]
else:
url = url + '/'
print url
url_list.append(url)
confirm = raw_input('About to create {} pages. Ready to wipe DB ([y]/n)? '.format(len(url_list)))
if confirm and confirm.upper() != 'Y':
print 'Aborting...'
sys.exit()
print 'Deleting all Page data'
Page.objects.all().delete()
if wipe_sysgen:
print 'Wiping sysgen'
for file in os.listdir(SYSGEN_PATH):
file_path = os.path.join(SYSGEN_PATH, file)
if os.isdir(file_path):
shutil.rmtree(file_path)
else:
os.unlink(file_path)
for url in sorted(url_list):
print 'Creating: ', url
page = Page(url=url)
page.update()
示例3: rebuild
# 需要导入模块: from models import Page [as 别名]
# 或者: from models.Page import update [as 别名]
def rebuild(pull_docinfo=True, wipe_sysgen=False):
'''
Designed to be run from shell.
Will wipe DB and load data from file system.
'''
pg_list = []
for root, dirs, files in os.walk(wiki_pages_path):
head = root.replace(wiki_pages_path, '')
path = head.split(os.sep)
for file in files:
pg = '/'.join(path + [file])
if pg[-1:] == '_':
pg = pg[:-1]
else:
pg = pg + '/'
print pg
pg_list.append(pg)
confirm = raw_input('About to create {} pages. Ready to wipe DB ([y]/n)? '.format(len(pg_list)))
if confirm and confirm.upper() != 'Y':
print 'Aborting...'
sys.exit()
print 'Deleting all Page data'
Page.objects.all().delete()
if wipe_sysgen:
print 'Wiping sysgen'
for file in os.listdir(SYSGEN_FOLDER):
file_path = os.path.join(SYSGEN_FOLDER, file)
if os.isdir(file_path):
shutil.rmtree(file_path)
else:
os.unlink(file_path)
for pg in sorted(pg_list):
print 'Creating: ', pg
page = Page(pg=pg)
page.update(pull_docinfo=pull_docinfo)