本文整理汇总了Python中the_tale.accounts.friends.prototypes.FriendshipPrototype类的典型用法代码示例。如果您正苦于以下问题:Python FriendshipPrototype类的具体用法?Python FriendshipPrototype怎么用?Python FriendshipPrototype使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FriendshipPrototype类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_show_friends_request_to_button
def test_show_friends_request_to_button(self):
self.request_login('[email protected]')
texts = [('pgf-friends-request-friendship', 0),
('pgf-friends-in-list', 0),
('pgf-friends-request-from', 0),
('pgf-friends-request-to', 1)]
FriendshipPrototype.request_friendship(self.account_2, self.account_1, text=u'text')
self.check_html_ok(self.request_html(reverse('accounts:show', args=[self.account_1.id])), texts=texts)
开发者ID:Jazzis18,项目名称:the-tale,代码行数:8,代码来源:test_requests_account.py
示例2: test_request_friendship__his_request_exists
def test_request_friendship__his_request_exists(self):
his_request = FriendshipPrototype.request_friendship(self.account_2, self.account_1, u'text 1')
own_request = FriendshipPrototype.request_friendship(self.account_1, self.account_2, u'text 2')
self.assertEqual(his_request.id, own_request.id)
self.assertTrue(own_request.is_confirmed)
self.assertEqual(own_request.text_html, u'text 1')
self.assertEqual(Friendship.objects.all().count(), 1)
self.assertEqual(Message.objects.all().count(), 2)
self.assertEqual(Message.objects.all()[0].recipient_id, self.account_1.id)
self.assertEqual(Message.objects.all()[1].recipient_id, self.account_2.id)
开发者ID:Alkalit,项目名称:the-tale,代码行数:10,代码来源:test_prototypes.py
示例3: friends
def friends(self):
friends = FriendshipPrototype.get_friends_for(self.account)
candidates = FriendshipPrototype.get_candidates_for(self.account)
accounts_ids = [account.id for account in friends]
clans_ids = [model.clan_id for model in friends]
heroes = {hero.account_id: hero for hero in heroes_logic.load_heroes_by_account_ids(accounts_ids)}
clans = {clan.id: clan for clan in ClanPrototype.get_list_by_id(clans_ids)}
return self.template(
"friends/friends_list.html",
{"friends": friends, "candidates": candidates, "heroes": heroes, "clans": clans},
)
开发者ID:Tiendil,项目名称:the-tale,代码行数:11,代码来源:views.py
示例4: friends
def friends(self):
friends = FriendshipPrototype.get_friends_for(self.account)
candidates = FriendshipPrototype.get_candidates_for(self.account)
accounts_ids = [account.id for account in friends]
clans_ids = [ model.clan_id for model in friends]
heroes = dict( (model.account_id, HeroPrototype(model=model)) for model in Hero.objects.filter(account_id__in=accounts_ids))
clans = {clan.id:clan for clan in ClanPrototype.get_list_by_id(clans_ids)}
return self.template('friends/friends_list.html',
{'friends': friends,
'candidates': candidates,
'heroes': heroes,
'clans': clans})
开发者ID:Alkalit,项目名称:the-tale,代码行数:12,代码来源:views.py
示例5: request_friendship
def request_friendship(self, friend):
if friend.is_fast:
return self.json_error('friends.request_friendship.fast_friend', u'Вы не можете пригласить в друзья игрока не завершившего регистрацию')
if friend.id == get_system_user().id:
return self.json_error('friends.request_friendship.system_user', u'Вы не можете пригласить в друзья системного пользователя')
form = RequestForm(self.request.POST)
if not form.is_valid():
return self.json_error('friends.request_friendship.form_errors', form.errors)
FriendshipPrototype.request_friendship(self.account, friend, text=form.c.text)
return self.json_ok()
开发者ID:Jazzis18,项目名称:the-tale,代码行数:15,代码来源:views.py
示例6: test_request_friendship__new_request
def test_request_friendship__new_request(self):
own_request = FriendshipPrototype.request_friendship(self.account_1, self.account_2, u'text 1')
self.assertFalse(own_request.is_confirmed)
self.assertEqual(own_request.text_html, u'text 1')
self.assertEqual(Friendship.objects.all().count(), 1)
self.assertEqual(Message.objects.all().count(), 1)
self.assertEqual(Message.objects.all()[0].recipient_id, self.account_2.id)
开发者ID:Alkalit,项目名称:the-tale,代码行数:7,代码来源:test_prototypes.py
示例7: candidates
def candidates(self):
candidates = FriendshipPrototype.get_candidates_for(self.account)
accounts_ids = [account.id for account in candidates]
clans_ids = [ model.clan_id for model in candidates]
heroes = {hero.account_id: hero for hero in heroes_logic.load_heroes_by_account_ids(accounts_ids)}
clans = {clan.id:clan for clan in ClanPrototype.get_list_by_id(clans_ids)}
return self.template('friends/friends_candidates.html',
{'candidates': candidates,
'heroes': heroes,
'clans': clans})
开发者ID:Jazzis18,项目名称:the-tale,代码行数:10,代码来源:views.py
示例8: show
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,代码行数:19,代码来源:views.py
示例9: account_sidebar
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,代码行数:41,代码来源:jinjaglobals.py
示例10: show
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,代码行数:23,代码来源:views.py
示例11: remove
def remove(self, friend):
FriendshipPrototype.remove_friendship(self.account, friend)
return self.json_ok()
开发者ID:Jazzis18,项目名称:the-tale,代码行数:3,代码来源:views.py
示例12: accept_friendship
def accept_friendship(self, friend):
FriendshipPrototype.request_friendship(self.account, friend)
return self.json_ok()
开发者ID:Jazzis18,项目名称:the-tale,代码行数:3,代码来源:views.py
注:本文中的the_tale.accounts.friends.prototypes.FriendshipPrototype类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论