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


Python Group.put方法代码示例

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


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

示例1: insert

# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import put [as 别名]
    def insert(self, group_name):
        existing_group = self._get_group(group_name=group_name)
        if existing_group:
            return existing_group

        group = Group()
        group.user = self.user_key
        group.name = group_name
        group.put()
        return group
开发者ID:xplot,项目名称:imeet,代码行数:12,代码来源:group.py

示例2: save

# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import put [as 别名]
def save(request):
    password = post_param(request, 'password')
    name = post_param(request, 'name')
    members = post_param(request, 'members').split()
    group_id = post_param(request, 'group_id')
    owner_email = post_param(request, 'owner')
    group = None
    if group_id:
        try:
            group = get_group(long(group_id))
            require = check_user(group)
            if require:
                return redirect("/redirect/?%s" % require)
        except:
            return redirect('/group/edit/?errs=group_id')

        for member in get_users(group):
            if member.name not in members:
                return redirect('/group/edit/%s?errs=members' % group.key().id())

    members = save_users(members, group)
    owner = None
    try:
        owner = users.User(owner_email)
    except:
        owner = users.get_current_user()
        
    if group:
        group.members = members
        group.owner = owner
    else:
        group = Group(members = members,
                      password = password,
                      name = name,
                      owner = owner)

    while len(group.summaries) < len(members):
        group.summaries.append(0.0)
            
    group.put()
    return redirect('/redirect/group/')
开发者ID:dotnil,项目名称:fanju,代码行数:43,代码来源:views.py

示例3: post

# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import put [as 别名]
    def post(self):
        name = self.request.get('name')
        description = self.request.get('description')
        privateDescription = self.request.get('private_description')

        # Check if group name already exists
        existingGroups = Group.query(Group.name==name).fetch()
        if len(existingGroups) > 0:
            self.display_message('A group with this name already exists')
            return


        newGroup = Group(name=name, description=description, privateDescription=privateDescription)
        newGroup.put()

        newGroupMembership = GroupMembership()
        newGroupMembership.groupKey = newGroup.key
        newGroupMembership.userKey = self.user.key
        newGroupMembership.isAdministrator = True
        newGroupMembership.isModerator = True
        newGroupMembership.put()

        self.redirect(self.uri_for('home'))
开发者ID:fi4sk0,项目名称:supertinygroupware,代码行数:25,代码来源:main.py

示例4: groups_post

# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import put [as 别名]
def groups_post(request):
	name = request.REQUEST['name']
	parentId = request.REQUEST['id']
	type = request.REQUEST['type'] if ('type' in request.REQUEST) else 'group'
	# XXX errors
	#parentGroupQuery = Group.gql('WHERE __key__ = :1', parentId)
	if (parentId == None or parentId.__len__() == 0):
		key = None
	else:
		key = db.Key(parentId)
	if (type == 'group'):
		group = Group(name=name, parentGroup=key, calendarId=None)
	elif (type == 'user'):
		group = User(name=name, parentGroup=key, calendarId=None)
	key = group.put()
	return JsonResponse({'id' : key.__str__() })
开发者ID:qwer,项目名称:schedule,代码行数:18,代码来源:views.py


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