本文整理汇总了Python中models.Config.save方法的典型用法代码示例。如果您正苦于以下问题:Python Config.save方法的具体用法?Python Config.save怎么用?Python Config.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Config
的用法示例。
在下文中一共展示了Config.save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_default_configs
# 需要导入模块: from models import Config [as 别名]
# 或者: from models.Config import save [as 别名]
def create_default_configs(request, user, is_new, **kwargs):
if is_new:
cf = Config()
cf.name = "Default config"
cf.user = user
cf.sv_motd = 'Standard capture the flag game'
cf.save()
示例2: register
# 需要导入模块: from models import Config [as 别名]
# 或者: from models.Config import save [as 别名]
def register(request):
if request.method == "GET":
template = get_template('registration/register.html')
context = RequestContext(request, {})
return HttpResponse(template.render(context))
elif request.method == "POST":
username = strip_tags(request.POST.get('username'))
password = make_password(request.POST.get('password'))
title = "Pagina de " + username
user = User(username=username, password=password)
user.save()
user = User.objects.get(username=username)
config = Config(user=user, title=title, color='#D7C4B7', size=14)
config.save()
return HttpResponseRedirect("/")
else:
template = get_template('notfound.html')
return HttpResponseNotFound(template.render())