Ejemplo n.º 1
0
def iteration(request, group_slug, iteration_id):
    project = get_object_or_404( Project, slug=group_slug )
    read_access_or_403(project,request.user)
    iteration = get_object_or_404( Iteration, id=iteration_id )

    if request.method == 'POST': # If the form has been submitted...
        write_access_or_403(project,request.user)
        form = IterationForm( request.POST, instance=iteration)
        if form.is_valid(): # All validation rules pass
            iteration = form.save(  )
            request.user.message_set.create(message="Iteration Details Saved.")
    else:
        form = IterationForm( instance=iteration )

    today = datetime.date.today()
    daysLeft = None
    try:
        if iteration.start_date <= today and iteration.end_date >= today:
            daysLeft = (iteration.end_date - today).days
    except:
        pass

    add_story_form = handleAddStory(request, project)

    return render_to_response("projects/iteration.html", {
        "iteration": iteration,
        "iterationinfo": True,
        "project" : project,
        "iteration_form": form,
        'daysLeft': daysLeft,
        'add_story_form': add_story_form,
        "current_view":"iteration_page"
      }, context_instance=RequestContext(request))
Ejemplo n.º 2
0
def project(request, group_slug=None, form_class=ProjectUpdateForm, adduser_form_class=AddUserForm,
        template_name="projects/project.html"):
    project = get_object_or_404(Project, slug=group_slug)
    read_access_or_403(project, request.user )
    if not request.user.is_authenticated():
        is_member = False
    else:
        is_member = project.user_is_member(request.user)

    action = request.POST.get("action")
    if action == "update":
        write_access_or_403(project, request.user )
        project_form = form_class(request.POST, instance=project)
        if project_form.is_valid():
            project = project_form.save()
    else:
        project_form = form_class(instance=project)

    add_story_form = handleAddStory(request, project)


    return render_to_response(template_name, {
        "project_form": project_form,
        "add_story_form": add_story_form,
        "project": project,
        "group": project, # @@@ this should be the only context var for the project
        "is_member": is_member,
        "current_view":"project_page"
    }, context_instance=RequestContext(request))
Ejemplo n.º 3
0
def project(request,
            group_slug=None,
            form_class=ProjectUpdateForm,
            adduser_form_class=AddUserForm,
            template_name="projects/project.html"):
    project = get_object_or_404(Project, slug=group_slug)
    read_access_or_403(project, request.user)
    if not request.user.is_authenticated():
        is_member = False
    else:
        is_member = project.user_is_member(request.user)

    action = request.POST.get("action")
    if action == "update":
        write_access_or_403(project, request.user)
        project_form = form_class(request.POST, instance=project)
        if project_form.is_valid():
            project = project_form.save()
    else:
        project_form = form_class(instance=project)

    add_story_form = handleAddStory(request, project)

    return render_to_response(
        template_name,
        {
            "project_form": project_form,
            "add_story_form": add_story_form,
            "project": project,
            "group":
            project,  # @@@ this should be the only context var for the project
            "is_member": is_member,
            "current_view": "project_page"
        },
        context_instance=RequestContext(request))
Ejemplo n.º 4
0
def tag_detail(request, group_slug, tag_name):
    project = get_object_or_404( Project, slug=group_slug )
    
    read_access_or_403(project,request.user)
    tags_list = StoryTag.objects.filter( project=project, name=tag_name )

    stories = []
    for tags in tags_list:
        # TODO: there's a bug somewhere causing duplicate tags to be created
        stories += [ tagging.story for tagging in tags.stories.all() ]
    
    stories = sorted(stories, key=lambda story: story.rank)
    add_story_form = handleAddStory(request, project)

    if len(tags_list) == 0:
        tag = None
    else:
        tag = tags_list[0]

    return render_to_response("projects/tag_page.html", {
        "tag": tag,
        "stories":stories,
        "organization":_organizationOrNone(project),
        "project" : project,
        'add_story_form': add_story_form,
        "current_view":"tags_view"
      }, context_instance=RequestContext(request))
Ejemplo n.º 5
0
def scrum_board(request, group_slug, iteration_id):
    project = get_object_or_404(Project, slug=group_slug)
    iteration = get_object_or_404(Iteration, id=iteration_id)
    read_access_or_403(project,request.user)
    if iteration.project != project:
        raise PermissionDenied()
    add_story_form = handleAddStory(request, project)
    return render_to_response('projects/scrum_board.html', { 'project':project, 'iteration':iteration, "add_story_form":add_story_form  }, context_instance=RequestContext(request))
Ejemplo n.º 6
0
def scrum_board(request, group_slug, iteration_id):
    project = get_object_or_404(Project, slug=group_slug)
    iteration = get_object_or_404(Iteration, id=iteration_id)
    read_access_or_403(project, request.user)
    if iteration.project != project:
        raise PermissionDenied()
    add_story_form = handleAddStory(request, project)
    return render_to_response('projects/scrum_board.html', {
        'project': project,
        'iteration': iteration,
        "add_story_form": add_story_form
    },
                              context_instance=RequestContext(request))
Ejemplo n.º 7
0
def epics(request, group_slug):
    project = get_object_or_404( Project, slug=group_slug )
    archived = request.GET.get("show_archived","false") == "true"
    read_access_or_403(project, request.user )
    epics = project.epics.filter(parent__isnull=True)
    if not archived:
        epics = epics.filter(archived=False)
    first_time = len(epics) == 0
    epics_list = _flattenEpics(epics)
    organization = _organizationOrNone(project)
    add_story_form = handleAddStory(request, project)
    add_epic_form = EpicForm(project)

    return render_to_response("projects/epics.html", 
                              {
                                "project":project,
                                "epic_list":epics_list,
                                "organization":organization,
                                "add_story_form":add_story_form,
                                "add_epic_form":add_epic_form,
                                "archived":archived,
                                "first_time":first_time
                              },
                              context_instance=RequestContext(request))
Ejemplo n.º 8
0
def epics(request, group_slug):
    project = get_object_or_404( Project, slug=group_slug )
    archived = request.GET.get("show_archived","false") == "true"
    read_access_or_403(project, request.user )
    epics = project.epics.filter(parent__isnull=True)
    if not archived:
        epics = epics.filter(archived=False)
    first_time = len(epics) == 0
    epics_list = _flattenEpics(epics)
    organization = _organizationOrNone(project)
    add_story_form = handleAddStory(request, project)
    add_epic_form = EpicForm(project)

    return render_to_response("projects/epics.html", 
                              {
                                "project":project,
                                "epic_list":epics_list,
                                "organization":organization,
                                "add_story_form":add_story_form,
                                "add_epic_form":add_epic_form,
                                "archived":archived,
                                "first_time":first_time
                              },
                              context_instance=RequestContext(request))