本文整理汇总了Python中models.Group.edit方法的典型用法代码示例。如果您正苦于以下问题:Python Group.edit方法的具体用法?Python Group.edit怎么用?Python Group.edit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Group
的用法示例。
在下文中一共展示了Group.edit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: group_edit_view
# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import edit [as 别名]
def group_edit_view(request):
"""returns current group information for editing and then collects
all information that has been added by the user whether new or existing
and edits the existing entries.
"""
username = request.authenticated_userid
group = Group.lookup_by_attribute(name=request.matchdict['group_name'])[0]
criteria = Criteria.lookup_by_attribute(group=group)[0]
if request.method == 'POST':
criteria = Criteria.edit(location=request.params.getall('location'),
taste=request.params.getall('taste'),
diet=request.params.getall('diet'),
cost=request.params.getall('cost'),
age=request.params.getall('age'),
id=criteria.id)
group = Group.edit(name=request.params.get('name'),
description=request.params.get('description'),
id=group.id)
return HTTPFound(request.route_url('group_detail',
group_name=group.name))
profile = {}
profile['criteria'] = criteria
profile['group'] = group
profile['username'] = username
return profile
示例2: post
# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import edit [as 别名]
def post(self):
# Check if the list name is provided
group_key = self.request.get('group_key')
name = self.request.get('name')
photo = self.request.get('photo')
try:
# Add the new list to the database
new_content = Group.edit(group_key, name, photo)
# Respond with the list key
self.response.set_status(201)
self.response.write(new_content)
except Exception as e:
# Respond with the error
self.response.set_status(406)
self.response.write(str(e))