• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python current_user._get_current_object函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中udata.auth.current_user._get_current_object函数的典型用法代码示例。如果您正苦于以下问题:Python _get_current_object函数的具体用法?Python _get_current_object怎么用?Python _get_current_object使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: save

    def save(self, commit=True, **kwargs):
        dataset = super(DatasetCreateForm, self).save(commit=False, **kwargs)
        if not dataset.organization:
            dataset.owner = current_user._get_current_object()

        if commit:
            dataset.save()

        return dataset
开发者ID:guillo-w,项目名称:udata,代码行数:9,代码来源:forms.py


示例2: reject_source

def reject_source(ident, comment):
    '''Reject a source for automatic harvesting'''
    source = get_source(ident)
    source.validation.on = datetime.now()
    source.validation.comment = comment
    source.validation.state = VALIDATION_REFUSED
    if current_user.is_authenticated():
        source.validation.by = current_user._get_current_object()
    source.save()
    return source
开发者ID:anukat2015,项目名称:udata,代码行数:10,代码来源:actions.py


示例3: refuse_transfer

def refuse_transfer(transfer, comment=None):
    '''Refuse an incoming a transfer request'''
    TransferResponsePermission(transfer).test()

    transfer.responded = datetime.now()
    transfer.responder = current_user._get_current_object()
    transfer.status = 'refused'
    transfer.response_comment = comment
    transfer.save()

    return transfer
开发者ID:odtvince,项目名称:udata,代码行数:11,代码来源:actions.py


示例4: validate_source

def validate_source(ident, comment=None):
    '''Validate a source for automatic harvesting'''
    source = get_source(ident)
    source.validation.on = datetime.now()
    source.validation.comment = comment
    source.validation.state = VALIDATION_ACCEPTED
    if current_user.is_authenticated():
        source.validation.by = current_user._get_current_object()
    source.save()
    launch(ident)
    return source
开发者ID:anukat2015,项目名称:udata,代码行数:11,代码来源:actions.py


示例5: save_grant

def save_grant(client_id, code, request, *args, **kwargs):
    # decide the expires time yourself
    expires = datetime.utcnow() + timedelta(seconds=GRANT_EXPIRATION)
    return OAuth2Grant.objects.create(
        client=ObjectId(client_id),
        code=code['code'],
        redirect_uri=request.redirect_uri,
        scopes=request.scopes,
        user=current_user._get_current_object(),
        expires=expires
    )
开发者ID:anukat2015,项目名称:udata,代码行数:11,代码来源:oauth2.py


示例6: validate_source

def validate_source(ident, comment=None):
    '''Validate a source for automatic harvesting'''
    source = get_source(ident)
    source.validation.on = datetime.now()
    source.validation.comment = comment
    source.validation.state = VALIDATION_ACCEPTED
    if current_user.is_authenticated:
        source.validation.by = current_user._get_current_object()
    source.save()
    schedule(ident, cron=current_app.config['HARVEST_DEFAULT_SCHEDULE'])
    launch(ident)
    return source
开发者ID:odtvince,项目名称:udata,代码行数:12,代码来源:actions.py


示例7: save

    def save(self, commit=True, **kwargs):
        '''Register the current user as admin on creation'''
        org = super(OrganizationForm, self).save(commit=False, **kwargs)

        if not org.id:
            user = current_user._get_current_object()
            member = Member(user=user, role='admin')
            org.members.append(member)

        if commit:
            org.save()

        return org
开发者ID:opendatateam,项目名称:udata,代码行数:13,代码来源:forms.py


示例8: post

    def post(self, org, id):
        '''Refuse user membership to a given organization.'''
        membership_request = self.get_or_404(org, id)
        form = api.validate(MembershipRefuseForm)

        membership_request.status = 'refused'
        membership_request.handled_by = current_user._get_current_object()
        membership_request.handled_on = datetime.now()
        membership_request.refusal_comment = form.comment.data

        org.save()

        return {}, 200
开发者ID:pombredanne,项目名称:udata,代码行数:13,代码来源:api.py


示例9: post

    def post(self, org, id):
        """Refuse user membership to a given organization."""
        EditOrganizationPermission(org).test()
        membership_request = self.get_or_404(org, id)
        form = api.validate(MembershipRefuseForm)
        membership_request.status = "refused"
        membership_request.handled_by = current_user._get_current_object()
        membership_request.handled_on = datetime.now()
        membership_request.refusal_comment = form.comment.data

        org.save()

        notify_membership_response.delay(org, membership_request)

        return {}, 200
开发者ID:javanna2000,项目名称:udata,代码行数:15,代码来源:api.py


示例10: post

    def post(self, org, id):
        '''Accept user membership to a given organization.'''
        EditOrganizationPermission(org).test()
        membership_request = self.get_or_404(org, id)

        if org.is_member(membership_request.user):
            return org.member(membership_request.user), 409

        membership_request.status = 'accepted'
        membership_request.handled_by = current_user._get_current_object()
        membership_request.handled_on = datetime.now()
        member = Member(user=membership_request.user, role='editor')

        org.members.append(member)
        org.save()

        notify_membership_response.delay(org, membership_request)

        return member
开发者ID:opendatateam,项目名称:udata,代码行数:19,代码来源:api.py


示例11: accept_transfer

def accept_transfer(transfer, comment=None):
    '''Accept an incoming a transfer request'''
    TransferResponsePermission(transfer).test()

    transfer.responded = datetime.now()
    transfer.responder = current_user._get_current_object()
    transfer.status = 'accepted'
    transfer.response_comment = comment
    transfer.save()

    subject = transfer.subject
    recipient = transfer.recipient
    if isinstance(recipient, Organization):
        subject.organization = recipient
    elif isinstance(recipient, User):
        subject.owner = recipient

    subject.save()

    return transfer
开发者ID:odtvince,项目名称:udata,代码行数:20,代码来源:actions.py


示例12: on_user_deleted_dataset

def on_user_deleted_dataset(dataset):
    if (not dataset.private and current_user and
            current_user.is_authenticated):
        user = current_user._get_current_object()
        organization = dataset.organization
        write_activity.delay(UserDeletedDataset, user, dataset, organization)
开发者ID:michelbl,项目名称:udata,代码行数:6,代码来源:activities.py


示例13: is_following

def is_following(obj):
    return current_user.is_authenticated() and Follow.objects.is_following(current_user._get_current_object(), obj)
开发者ID:guillo-w,项目名称:udata,代码行数:2,代码来源:views.py


示例14: get

 def get(self):
     '''List all current user pending notifications'''
     user = current_user._get_current_object()
     return get_notifications(user)
开发者ID:anukat2015,项目名称:udata,代码行数:4,代码来源:api.py


示例15: inject_organization_needs

def inject_organization_needs(sender, identity):
    if current_user.is_authenticated():
        for org in Organization.objects(members__user=current_user.id):
            membership = get_by(org.members, 'user', current_user._get_current_object())
            identity.provides.add(OrganizationNeed(membership.role, org.id))
开发者ID:guillo-w,项目名称:udata,代码行数:5,代码来源:permissions.py


示例16: emit

 def emit(cls, related_to, organization=None, **kwargs):
     return cls.objects.create(
         actor=current_user._get_current_object(),
         related_to=related_to,
         organization=organization
     )
开发者ID:odtvince,项目名称:udata,代码行数:6,代码来源:models.py


示例17: is_following

def is_following(obj):
    if not current_user.is_authenticated:
        return False
    return Follow.objects.is_following(current_user._get_current_object(), obj)
开发者ID:opendatalu,项目名称:udata,代码行数:4,代码来源:views.py


示例18: default_owner

def default_owner():
    '''Default to current_user if authenticated'''
    if current_user.is_authenticated():
        return current_user._get_current_object()
开发者ID:grouan,项目名称:udata,代码行数:4,代码来源:fields.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python csv.stream函数代码示例发布时间:2022-05-27
下一篇:
Python auth.login_user函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap