本文整理汇总了Python中models.Form.born方法的典型用法代码示例。如果您正苦于以下问题:Python Form.born方法的具体用法?Python Form.born怎么用?Python Form.born使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Form
的用法示例。
在下文中一共展示了Form.born方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: registration
# 需要导入模块: from models import Form [as 别名]
# 或者: from models.Form import born [as 别名]
def registration(request):
if request.method == 'POST':
form = RegistrationForm(request.POST)
if form.is_valid():
data = form.cleaned_data
model = Form()
model.fullname = data['fullname']
model.wcaid = data['wcaid']
model.country = data['country']
model.city = data['city']
model.email = data['email']
model.tshirt = data['tshirt']
model.nick = data['nick']
model.accomodation = data['accomodation']
model.born = datetime.date(int(data['bornyear']), int(data['bornmonth']), int(data['bornday']))
model.events = [str(ev) for ev in data if ev.startswith('ev_') and data[ev] == True]
model.status = 1
model.put()
return HttpResponseRedirect('/thanks')
else:
form = RegistrationForm()
return render_to_response('registration.html', {
'form': form,
'page': 'registration',
'years': range(1900, 2009),
'months': range(1, 13),
'days': range(1, 32),
})