本文整理汇总了Python中django.contrib.flatpages.models.FlatPage.template_name方法的典型用法代码示例。如果您正苦于以下问题:Python FlatPage.template_name方法的具体用法?Python FlatPage.template_name怎么用?Python FlatPage.template_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.contrib.flatpages.models.FlatPage
的用法示例。
在下文中一共展示了FlatPage.template_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from django.contrib.flatpages.models import FlatPage [as 别名]
# 或者: from django.contrib.flatpages.models.FlatPage import template_name [as 别名]
def main():
applicants = read_results()
flatpages = FlatPage.objects.filter(url=url)
if len(flatpages)==0:
flatpage = FlatPage(url=url)
elif is_forced:
flatpage = flatpages[0]
else:
print "\nError: old flatpage exists. Use --force to force overwrite."
quit()
template = get_template('result/include/applicant_list.html')
context = Context({'applicants': applicants})
flatpage.title = u'ประกาศ'
flatpage.content = template.render(context)
flatpage.template_name = 'flatpages/result.html'
flatpage.save()
print """.....
Done.
The script only created a flatpage at %s for you.
You'll have to set the title, its sites,
and edit other part of the page yourself.""" % (url,)