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


Python FriendshipPrototype.get_for_bidirectional方法代码示例

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


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

示例1: show

# 需要导入模块: from the_tale.accounts.friends.prototypes import FriendshipPrototype [as 别名]
# 或者: from the_tale.accounts.friends.prototypes.FriendshipPrototype import get_for_bidirectional [as 别名]
def show(context):
    from the_tale.game.ratings import relations as ratings_relations
    from the_tale.game.ratings import conf as ratings_conf

    friendship = FriendshipPrototype.get_for_bidirectional(context.account, context.master_account)

    master_hero = HeroPrototype.get_by_account_id(context.master_account.id)

    return dext_views.Page('accounts/show.html',
                           content={'master_hero': master_hero,
                                    'account_meta_object': meta_relations.Account.create_from_object(context.master_account),
                                    'account_info': logic.get_account_info(context.master_account, master_hero),
                                    'master_account': context.master_account,
                                    'accounts_settings': conf.accounts_settings,
                                    'RATING_TYPE': ratings_relations.RATING_TYPE,
                                    'resource': context.resource,
                                    'ratings_on_page': ratings_conf.ratings_settings.ACCOUNTS_ON_PAGE,
                                    'informer_link': conf.accounts_settings.INFORMER_LINK % {'account_id': context.master_account.id},
                                    'friendship': friendship} )
开发者ID:alexudracul,项目名称:the-tale,代码行数:21,代码来源:views.py

示例2: account_sidebar

# 需要导入模块: from the_tale.accounts.friends.prototypes import FriendshipPrototype [as 别名]
# 或者: from the_tale.accounts.friends.prototypes.FriendshipPrototype import get_for_bidirectional [as 别名]
def account_sidebar(user_account, page_account, page_caption, page_type, can_moderate=False):
    from the_tale.forum.models import Thread
    from the_tale.game.bills.prototypes import BillPrototype
    from the_tale.linguistics.prototypes import ContributionPrototype
    from the_tale.linguistics.relations import CONTRIBUTION_TYPE
    from the_tale.accounts.friends.prototypes import FriendshipPrototype
    from the_tale.accounts.clans.logic import ClanInfo
    from the_tale.blogs.models import Post as BlogPost, POST_STATE as BLOG_POST_STATE

    bills_count = BillPrototype.accepted_bills_count(page_account.id)

    threads_count = Thread.objects.filter(author=page_account._model).count()

    threads_with_posts = Thread.objects.filter(post__author=page_account._model).distinct().count()

    templates_count = ContributionPrototype._db_filter(account_id=page_account.id,
                                                       type=CONTRIBUTION_TYPE.TEMPLATE).count()

    words_count = ContributionPrototype._db_filter(account_id=page_account.id,
                                                   type=CONTRIBUTION_TYPE.WORD).count()

    folclor_posts_count = BlogPost.objects.filter(author=page_account._model, state=BLOG_POST_STATE.ACCEPTED).count()

    friendship = FriendshipPrototype.get_for_bidirectional(user_account, page_account)

    return jinja2.Markup(jinja2.render('accounts/sidebar.html',
                                            context={'user_account': user_account,
                                                     'page_account': page_account,
                                                     'page_caption': page_caption,
                                                     'master_clan_info': ClanInfo(page_account),
                                                     'own_clan_info': ClanInfo(user_account),
                                                     'friendship': friendship,
                                                     'bills_count': bills_count,
                                                     'templates_count': templates_count,
                                                     'words_count': words_count,
                                                     'folclor_posts_count': folclor_posts_count,
                                                     'threads_count': threads_count,
                                                     'threads_with_posts': threads_with_posts,
                                                     'can_moderate': can_moderate,
                                                     'page_type': page_type,
                                                     'commission': conf.accounts_settings.MONEY_SEND_COMMISSION}))
开发者ID:Alkalit,项目名称:the-tale,代码行数:43,代码来源:jinjaglobals.py

示例3: show

# 需要导入模块: from the_tale.accounts.friends.prototypes import FriendshipPrototype [as 别名]
# 或者: from the_tale.accounts.friends.prototypes.FriendshipPrototype import get_for_bidirectional [as 别名]
def show(context):
    from the_tale.game.ratings import relations as ratings_relations
    from the_tale.game.ratings import conf as ratings_conf

    friendship = FriendshipPrototype.get_for_bidirectional(context.account, context.master_account)

    master_hero = heroes_logic.load_hero(account_id=context.master_account.id)

    return dext_views.Page(
        "accounts/show.html",
        content={
            "master_hero": master_hero,
            "account_meta_object": meta_relations.Account.create_from_object(context.master_account),
            "account_info": logic.get_account_info(context.master_account, master_hero),
            "master_account": context.master_account,
            "accounts_settings": conf.accounts_settings,
            "RATING_TYPE": ratings_relations.RATING_TYPE,
            "resource": context.resource,
            "ratings_on_page": ratings_conf.ratings_settings.ACCOUNTS_ON_PAGE,
            "informer_link": conf.accounts_settings.INFORMER_LINK % {"account_id": context.master_account.id},
            "friendship": friendship,
        },
    )
开发者ID:Tiendil,项目名称:the-tale,代码行数:25,代码来源:views.py


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