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


Python DataManager.add_role_to_event方法代码示例

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


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

示例1: user_role_invite

# 需要导入模块: from app.helpers.data import DataManager [as 别名]
# 或者: from app.helpers.data.DataManager import add_role_to_event [as 别名]
def user_role_invite(event_id, hash):
    """Accept User-Role invite for the event.
    """
    event = DataGetter.get_event(event_id)
    user = current_user
    role_invite = DataGetter.get_event_role_invite(event.id, hash,
                                                   email=user.email)

    if role_invite:
        if role_invite.has_expired():
            delete_from_db(role_invite, 'Deleted RoleInvite')

            flash('Sorry, the invitation link has expired.', 'error')
            return redirect(url_for('.details_view', event_id=event.id))

        if user.has_role(event.id):
            flash('You have already been assigned a Role in the Event.', 'warning')
            return redirect(url_for('events.details_view', event_id=event_id))

        role = role_invite.role
        data = dict()
        data['user_email'] = role_invite.email
        data['user_role'] = role.name
        DataManager.add_role_to_event(data, event.id)

        # Delete Role Invite after it has been accepted
        delete_from_db(role_invite, 'Deleted RoleInvite')

        flash('You have been added as a %s' % role.title_name)
        return redirect(url_for('.details_view', event_id=event.id))
    else:
        abort(404)
开发者ID:codebhendi,项目名称:open-event-orga-server,代码行数:34,代码来源:events.py

示例2: create_event

# 需要导入模块: from app.helpers.data import DataManager [as 别名]
# 或者: from app.helpers.data.DataManager import add_role_to_event [as 别名]
def create_event(name='TestEvent', creator_email=None):
    """Creates Event and returns its `id`.
    :param name Name of Event
    """
    copyright = Copyright(holder='copyright holder')
    event = Event(name=name,
                  start_time=datetime(2016, 4, 8, 12, 30, 45),
                  end_time=datetime(2016, 4, 9, 12, 30, 45),
                  copyright=copyright)
    if creator_email:
        event.creator = User.query.filter_by(email=creator_email).first()

    save_to_db(event, 'Event saved')

    if creator_email:
        # Add creator as Organizer
        data = {
            'user_email': creator_email,
            'user_role': ORGANIZER,
        }
        DataManager.add_role_to_event(data, event.id, record=False)

    return event.id
开发者ID:ashishpahwa7,项目名称:open-event-orga-server,代码行数:25,代码来源:utils.py

示例3: create_event

# 需要导入模块: from app.helpers.data import DataManager [as 别名]
# 或者: from app.helpers.data.DataManager import add_role_to_event [as 别名]
def create_event(name='TestEvent', creator_email=None, **kwargs):
    """Creates Event and returns its `id`.
    :param creator_email:
    :param name Name of Event
    """
    event = Event(name=name,
                  start_time=datetime(2016, 4, 8, 12, 30, 45),
                  end_time=datetime(2016, 4, 9, 12, 30, 45),
                  **kwargs)

    save_to_db(event, 'Event saved')

    copyright = Copyright(holder='copyright holder', event=event)
    save_to_db(copyright, "Copyright saved")

    if creator_email:
        # Add creator as Organizer
        data = {
            'user_email': creator_email,
            'user_role': ORGANIZER,
        }
        DataManager.add_role_to_event(data, event.id, record=False)

    return event.id
开发者ID:codebhendi,项目名称:open-event-orga-server,代码行数:26,代码来源:utils.py


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