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


Python Group.get_functional_areas方法代码示例

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


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

示例1: test_get_functional_areas

# 需要导入模块: from mozillians.groups.models import Group [as 别名]
# 或者: from mozillians.groups.models.Group import get_functional_areas [as 别名]
 def test_get_functional_areas(self):
     GroupFactory.create()
     GroupFactory.create()
     UserFactory.create()
     UserFactory.create()
     cgroup_1 = GroupFactory.create(functional_area=True)
     GroupFactory.create(functional_area=False)
     eq_(set(Group.get_functional_areas()), set([cgroup_1]))
开发者ID:Acidburn0zzz,项目名称:mozillians,代码行数:10,代码来源:test_models.py

示例2: get_context_data

# 需要导入模块: from mozillians.groups.models import Group [as 别名]
# 或者: from mozillians.groups.models.Group import get_functional_areas [as 别名]
 def get_context_data(self, **kwargs):
     """Override method to pass more context data in the template."""
     context_data = super(PhonebookSearchView, self).get_context_data(**kwargs)
     context_data['functional_areas'] = Group.get_functional_areas()
     context_data['show_pagination'] = context_data['is_paginated']
     context_data['search_form'] = context_data['form']
     context_data['country'] = self.kwargs.get('country')
     context_data['region'] = self.kwargs.get('region')
     context_data['city'] = self.kwargs.get('city')
     return context_data
开发者ID:johngian,项目名称:mozillians,代码行数:12,代码来源:views.py

示例3: betasearch

# 需要导入模块: from mozillians.groups.models import Group [as 别名]
# 或者: from mozillians.groups.models.Group import get_functional_areas [as 别名]
def betasearch(request):
    """This view is for researching new search and data filtering
    options. It will eventually replace the 'search' view.

    This view is behind the 'betasearch' waffle flag.
    """
    limit = None
    people = []
    show_pagination = False
    form = forms.SearchForm(request.GET)
    groups = None
    functional_areas = None

    if form.is_valid():
        query = form.cleaned_data.get('q', u'')
        limit = form.cleaned_data['limit']
        include_non_vouched = form.cleaned_data['include_non_vouched']
        page = request.GET.get('page', 1)
        functional_areas = Group.get_functional_areas()
        public = not (request.user.is_authenticated()
                      and request.user.userprofile.is_vouched)

        profiles = UserProfile.search(query, public=public,
                                      include_non_vouched=include_non_vouched)
        if not public:
            groups = Group.search(query)

        paginator = Paginator(profiles, limit)

        try:
            people = paginator.page(page)
        except PageNotAnInteger:
            people = paginator.page(1)
        except EmptyPage:
            people = paginator.page(paginator.num_pages)

        if profiles.count() == 1 and not groups:
            return redirect('phonebook:profile_view', people[0].user.username)

        show_pagination = paginator.count > settings.ITEMS_PER_PAGE

    d = dict(people=people,
             search_form=form,
             limit=limit,
             show_pagination=show_pagination,
             groups=groups,
             functional_areas=functional_areas)

    return render(request, 'phonebook/betasearch.html', d)
开发者ID:maheshkkumar,项目名称:mozillians,代码行数:51,代码来源:views.py

示例4: search

# 需要导入模块: from mozillians.groups.models import Group [as 别名]
# 或者: from mozillians.groups.models.Group import get_functional_areas [as 别名]
def search(request):
    limit = None
    people = []
    show_pagination = False
    form = forms.SearchForm(request.GET)
    groups = None
    functional_areas = None

    if form.is_valid():
        query = form.cleaned_data.get("q", u"")
        limit = form.cleaned_data["limit"]
        include_non_vouched = form.cleaned_data["include_non_vouched"]
        page = request.GET.get("page", 1)
        functional_areas = Group.get_functional_areas()
        public = not (request.user.is_authenticated() and request.user.userprofile.is_vouched)

        profiles = UserProfile.search(query, public=public, include_non_vouched=include_non_vouched)
        if not public:
            groups = Group.search(query)

        paginator = Paginator(profiles, limit)

        try:
            people = paginator.page(page)
        except PageNotAnInteger:
            people = paginator.page(1)
        except EmptyPage:
            people = paginator.page(paginator.num_pages)

        if profiles.count() == 1 and not groups:
            return redirect("phonebook:profile_view", people[0].user.username)

        show_pagination = paginator.count > settings.ITEMS_PER_PAGE

    d = dict(
        people=people,
        search_form=form,
        limit=limit,
        show_pagination=show_pagination,
        groups=groups,
        functional_areas=functional_areas,
    )

    return render(request, "phonebook/search.html", d)
开发者ID:J0WI,项目名称:mozillians,代码行数:46,代码来源:views.py

示例5: index_functional_areas

# 需要导入模块: from mozillians.groups.models import Group [as 别名]
# 或者: from mozillians.groups.models.Group import get_functional_areas [as 别名]
def index_functional_areas(request):
    """Lists all functional areas."""
    query = Group.get_functional_areas()
    template = 'groups/index_areas.html'
    return _list_groups(request, template, query)
开发者ID:CodeBreaker24,项目名称:mozillians,代码行数:7,代码来源:views.py


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