本文整理汇总了Python中models.Account.owner方法的典型用法代码示例。如果您正苦于以下问题:Python Account.owner方法的具体用法?Python Account.owner怎么用?Python Account.owner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Account
的用法示例。
在下文中一共展示了Account.owner方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: register_page
# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import owner [as 别名]
def register_page(request):
if request.method == 'POST':
form = FormularzRejestracji(request.POST)
if form.is_valid():
user = User.objects.create_user(
username=form.cleaned_data['username'],
password=form.cleaned_data['password1'],
)
user.save()
acc = Account()
acc.owner = user.username
acc.balance = 0
acc.save()
if form.cleaned_data['log_on']:
user = authenticate(username=form.cleaned_data['username'],password=form.cleaned_data['password1'])
login(request,user)
return HttpResponseRedirect("/blog/")
else:
template = get_template("registration/register_success.html")
variables = RequestContext(request,{'username':form.cleaned_data['username']})
output = template.render(variables)
return HttpResponse(output)
else:
form = FormularzRejestracji()
template = get_template("registration/register.html")
variables = RequestContext(request,{'form':form})
output = template.render(variables)
return HttpResponse(output)