当前位置: 首页>>代码示例>>Python>>正文


Python Form.put方法代码示例

本文整理汇总了Python中models.Form.put方法的典型用法代码示例。如果您正苦于以下问题:Python Form.put方法的具体用法?Python Form.put怎么用?Python Form.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Form的用法示例。


在下文中一共展示了Form.put方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: registration

# 需要导入模块: from models import Form [as 别名]
# 或者: from models.Form import put [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),
        })
开发者ID:MHordecki,项目名称:poznanopen,代码行数:32,代码来源:views.py

示例2: post

# 需要导入模块: from models import Form [as 别名]
# 或者: from models.Form import put [as 别名]
    def post(self):
        try:
            jsondata = json.loads(self.request.body)
        except UnicodeDecodeError:
            jsondata = json.loads(self.request.body,encoding='latin-1')

        logging.info(jsondata.keys())

        form = Form()
        
        procfields = []
        for i,f in enumerate(jsondata['fields']):
            procfields.append({
                'name': 'field{}'.format(i),
                'Descr': f['Descr'],
                'Val': f['Val']
                })
        
        form.creator = jsondata['creator']
        form.until = datetime.datetime.now() + datetime.timedelta(hours=jsondata['duration'])
        form.hashtag = jsondata['hashtag']
        form.fields = procfields
        form.description = jsondata['description']
        form.authenticated = not bool(jsondata['authenticated']) 
        form.info = jsondata['info']

        form.put()
开发者ID:guillemborrell,项目名称:btdotnet,代码行数:29,代码来源:rest.py

示例3: post

# 需要导入模块: from models import Form [as 别名]
# 或者: from models.Form import put [as 别名]
	def post(self):
		form = Form()
		self._update_form_from_request(form)
		
		form.put()
		
		logging.info("Created form '%s'" % form.key.urlsafe())
		
		self.redirect(self.uri_for('forms-list'))
开发者ID:vanderkleij,项目名称:MailFacade,代码行数:11,代码来源:admin.py


注:本文中的models.Form.put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。