Example #1
0
def tagged_tasks(request, project_slug, tags=None):
    """ Return tagged tasks """
    tag_list = tags.split("+")
    
    task_queryset = Task.objects.filter(project__slug=project_slug)
    queryset = TaggedItem.objects.get_intersection_by_model(task_queryset, tag_list)

    all_nodes = [(node, node.get_children_count()) for node in queryset]
    tags = Tag.objects.usage_for_queryset(queryset, counts=True)
    project = Project.objects.get(slug=project_slug)
    
    selected_tags = []
    tag_url = ''
    for item in tag_list:
        name = Tag.objects.get(name=item)
        tags.remove(name)
        selected_tags.append(name)
        tag_url += item + '+'

    return direct_to_template(request,
                              template='bltask/list.html',
                              extra_context={'nodes': structure(all_nodes),
                                             'nodes_count': len(all_nodes),
                                             'task_tags': tags,
                                             'tag_url': tag_url,
                                             'selected_tags': selected_tags,
                                             'project': project })
Example #2
0
def tagged_tasks(request, project_slug, tags=None):
    """ Return tagged tasks """
    tag_list = tags.split("+")

    task_queryset = Task.objects.filter(project__slug=project_slug)
    queryset = TaggedItem.objects.get_intersection_by_model(
        task_queryset, tag_list)

    all_nodes = [(node, node.get_children_count()) for node in queryset]
    tags = Tag.objects.usage_for_queryset(queryset, counts=True)
    project = Project.objects.get(slug=project_slug)

    selected_tags = []
    tag_url = ''
    for item in tag_list:
        name = Tag.objects.get(name=item)
        tags.remove(name)
        selected_tags.append(name)
        tag_url += item + '+'

    return direct_to_template(request,
                              template='bltask/list.html',
                              extra_context={
                                  'nodes': structure(all_nodes),
                                  'nodes_count': len(all_nodes),
                                  'task_tags': tags,
                                  'tag_url': tag_url,
                                  'selected_tags': selected_tags,
                                  'project': project
                              })
Example #3
0
def task_project_list(request, project_slug):
    """ 
    Lists all tasks for a project. Also looks for a optional depth ``GET``
    argument which supplies the depth of the tree.
    
    """
    project = get_object_or_404(Project, slug=project_slug, members=request.user)
    depth = request.GET.get('depth', None)
    all_nodes = Task.my_objects.get_nodes_for_project(project, depth) 
    tags = Tag.objects.usage_for_queryset(Task.objects.select_related().filter(project=project),
                                          counts=True)

    return direct_to_template(request,
                              template='bltask/list.html',
                              extra_context={
                                  'nodes': structure(all_nodes),
                                  'nodes_count': len(all_nodes),
                                  'project': project,
                                  'task_tags': tags})
Example #4
0
def task_project_list(request, project_slug):
    """ 
    Lists all tasks for a project. Also looks for a optional depth ``GET``
    argument which supplies the depth of the tree.
    
    """
    project = get_object_or_404(Project,
                                slug=project_slug,
                                members=request.user)
    depth = request.GET.get('depth', None)
    all_nodes = Task.my_objects.get_nodes_for_project(project, depth)
    tags = Tag.objects.usage_for_queryset(
        Task.objects.select_related().filter(project=project), counts=True)

    return direct_to_template(request,
                              template='bltask/list.html',
                              extra_context={
                                  'nodes': structure(all_nodes),
                                  'nodes_count': len(all_nodes),
                                  'project': project,
                                  'task_tags': tags
                              })