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


Python Task.get_project_count方法代码示例

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


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

示例1: project_task_count

# 需要导入模块: from tasks.models import Task [as 别名]
# 或者: from tasks.models.Task import get_project_count [as 别名]
def project_task_count(context, project, asvar=None):
    val = Task.get_project_count(project)
    if asvar:
        context[asvar] = val
        return ""
    else:
        return val
开发者ID:hbussell,项目名称:pinax-tracker,代码行数:9,代码来源:dashboard_tags.py

示例2: your_projects

# 需要导入模块: from tasks.models import Task [as 别名]
# 或者: from tasks.models.Task import get_project_count [as 别名]
def your_projects(request, template_name="projects/your_projects.html"):
    
    projects = Project.objects.filter(member_users=request.user).order_by("name")
    
    content_type = ContentType.objects.get_for_model(Project)
    
    projects = projects.extra(select=SortedDict([
        ("member_count", MEMBER_COUNT_SQL),
        ("topic_count", TOPIC_COUNT_SQL),
    ]), select_params=(content_type.id,))
    
    from tasks.models import Task
    for project in projects:
        project.task_count = Task.get_project_count(project)
       
    return render_to_response(template_name, {
        "projects": projects,
    }, context_instance=RequestContext(request))
开发者ID:hbussell,项目名称:pinax-tracker,代码行数:20,代码来源:views.py

示例3: projects

# 需要导入模块: from tasks.models import Task [as 别名]
# 或者: from tasks.models.Task import get_project_count [as 别名]
def projects(request, template_name="projects/projects.html"):
    
    projects = Project.objects.all()
    
    search_terms = request.GET.get("search", "")
    if search_terms:
        projects = (projects.filter(name__icontains=search_terms) |
            projects.filter(description__icontains=search_terms))
    
    content_type = ContentType.objects.get_for_model(Project)
    
    projects = projects.extra(select=SortedDict([
        ("member_count", MEMBER_COUNT_SQL),
        ("topic_count", TOPIC_COUNT_SQL),
    ]), select_params=(content_type.id,))
    from tasks.models import Task
    for project in projects:
        project.task_count = Task.get_project_count(project)

    return render_to_response(template_name, {
        "projects": projects,
        "search_terms": search_terms,
    }, context_instance=RequestContext(request))
开发者ID:hbussell,项目名称:pinax-tracker,代码行数:25,代码来源:views.py


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