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


Python Group.get_curated方法代码示例

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


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

示例1: test_get_curated

# 需要导入模块: from mozillians.groups.models import Group [as 别名]
# 或者: from mozillians.groups.models.Group import get_curated [as 别名]
 def test_get_curated(self):
     GroupFactory.create()
     GroupFactory.create()
     user_1 = UserFactory.create()
     user_2 = UserFactory.create()
     cgroup_1 = GroupFactory.create(steward=user_1.userprofile)
     cgroup_2 = GroupFactory.create(steward=user_2.userprofile)
     eq_(set(Group.get_curated()), set([cgroup_1, cgroup_2]))
开发者ID:Narrator,项目名称:mozillians,代码行数:10,代码来源:test_models.py

示例2: home

# 需要导入模块: from mozillians.groups.models import Group [as 别名]
# 或者: from mozillians.groups.models.Group import get_curated [as 别名]
def home(request):
    if request.user.is_authenticated():
        profile = request.user.get_profile()
        my_groups = profile.groups.exclude(steward=None).order_by("name")
        curated_groups = Group.get_curated()
        data = dict(groups=my_groups, curated_groups=curated_groups)
        return render(request, "phonebook/home.html", data)
    else:
        return render(request, "phonebook/home.html")
开发者ID:erinversfeld,项目名称:mozillians-new,代码行数:11,代码来源:views.py

示例3: search

# 需要导入模块: from mozillians.groups.models import Group [as 别名]
# 或者: from mozillians.groups.models.Group import get_curated [as 别名]
def search(request):
    num_pages = 0
    limit = None
    people = []
    show_pagination = False
    form = forms.SearchForm(request.GET)
    groups = None
    curated_groups = 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)
        curated_groups = Group.get_curated()
        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)

        if paginator.count > forms.PAGINATION_LIMIT:
            show_pagination = True
            num_pages = len(people.paginator.page_range)

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

    if request.is_ajax():
        return render(request, 'search_ajax.html', d)

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

示例4: search

# 需要导入模块: from mozillians.groups.models import Group [as 别名]
# 或者: from mozillians.groups.models.Group import get_curated [as 别名]
def search(request):
    limit = None
    people = []
    show_pagination = False
    form = forms.SearchForm(request.GET)
    groups = None
    curated_groups = 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)
        curated_groups = Group.get_curated()
        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,
        curated_groups=curated_groups,
    )

    if request.is_ajax():
        return render(request, "search_ajax.html", d)

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

示例5: index_functional_areas

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


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