Ejemplo n.º 1
0
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
        })
Ejemplo n.º 2
0
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} )
Ejemplo n.º 3
0
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}))
Ejemplo n.º 4
0
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,
        },
    )
Ejemplo n.º 5
0
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
                      }))