Example #1
0
def backlog(request, id = None, delete_selected=False, sprint=False):
	last_post = utils.get_session_data(request) or {}

	if delete_selected:
		ctx = {}
		if id:
			try:
				models.Story.objects.get(id=id).delete()
				return HttpResponseRedirect(reverse('web.backlog'))
			except models.Story.DoesNotExist:
				raise Http404
	else:
		open_stories = list(models.Story.objects.filter(state='BACKLOG'))
		open_stories.sort(story_comparator)
		ctx = {
			'sidebar_selected': 'backlog',
			'open_stories': open_stories
		}

		if id:
			try:
				if sprint:
					story = models.Story.objects.get(id=id)
					ctx['form'] = utils.init_form(request, reverse('web.backlog_story_storyparser_edit_submit_planning', args=[story.sprint.id]), forms.StoryParserForm, last_post, story)
				else:
					ctx['form'] = utils.init_form(request, reverse('web.backlog_story_storyparser_edit_submit', args=[id]), forms.StoryParserForm, last_post, models.Story.objects.get(id=id))
			except models.Story.DoesNotExist:
				raise Http404
		else:
			ctx['form'] = utils.init_form(request, reverse('web.backlog_story_submit', args=[]), forms.StoryParserForm, last_post, {})

	return render_to_response('pages/backlog.html', ctx, RequestContext(request))
Example #2
0
def planning_new_sprint(request):
	last_post = utils.get_session_data(request) or {}

	ctx = {
		'sidebar_selected': 'planning',
	    'form': utils.init_form(request, reverse('web.planning_new_sprint_submit', args=[]), forms.SprintForm, last_post, {})
	}
	return render_to_response('pages/planning_new_sprint.html', ctx, RequestContext(request))
Example #3
0
def planning_new_sprint(request):
    last_post = utils.get_session_data(request) or {}

    ctx = {
        "sidebar_selected": "planning",
        "form": utils.init_form(
            request, reverse("web.planning_new_sprint_submit", args=[]), forms.SprintForm, last_post, {}
        ),
    }
    return render_to_response("pages/planning_new_sprint.html", ctx, RequestContext(request))
Example #4
0
def my_stuff_story_fire(request, id=None):
    last_post = utils.get_session_data(request) or {}

    current_sprint_queryset = models.Sprint.objects.all().order_by("-date_ends")
    if current_sprint_queryset.count():
        current_sprint = current_sprint_queryset[0]
        open_stories = list(
            models.Story.objects.filter(sprint=current_sprint).filter(task__owner=request.user).distinct()
        )
        open_stories.sort(story_comparator)
    else:
        current_sprint = None
        open_stories = None

    initial = {"sprint_id": current_sprint.id if current_sprint else -1}

    args = []

    if id:
        try:
            fire = models.Story.objects.get(id=id)
            initial.update(
                {
                    "id": fire.id,
                    "title": fire.title,
                    "story_description": fire.story_description,
                    "tags": fire.tags,
                    "score": fire.task_set.all()[0].score,
                    "owner": fire.task_set.all()[0].owner,
                }
            )
        except models.Story.DoesNotExist:
            raise Http404

    ctx = {
        "form": utils.init_form(
            request, reverse("web.my_stuff_fire_submit", args=args), forms.FireForm, last_post, initial
        ),
        "open_stories": open_stories,
        "current_sprint": current_sprint,
        "sidebar_selected": "mystuff",
    }

    return render_to_response("pages/my_stuff_fire.html", ctx, RequestContext(request))
Example #5
0
def my_stuff_story_fire(request, id=None):
	last_post = utils.get_session_data(request) or {}

	current_sprint_queryset = models.Sprint.objects.filter(date_begins__lt=datetime.now()).filter(date_ends__gt=datetime.now())
	if current_sprint_queryset.count():
		current_sprint = current_sprint_queryset[0]
		open_stories = list(models.Story.objects.filter(sprint=current_sprint).filter(task__owner=request.user).distinct())
		open_stories.sort(story_comparator)
	else:
		current_sprint = None
		open_stories = None

	initial = {
		'sprint_id': current_sprint.id if current_sprint else -1,
	}

	args = []

	if id:
		try:
			fire = models.Story.objects.get(id=id)
			initial.update({
				'id': fire.id,
			    'title': fire.title,
			    'story_description': fire.story_description,
			    'tags': fire.tags,
			    'score': fire.task_set.all()[0].score,
			    'owner': fire.task_set.all()[0].owner,
			})
		except models.Story.DoesNotExist:
			raise Http404

	ctx = {
		'form': utils.init_form(request, reverse('web.my_stuff_fire_submit', args=args), forms.FireForm, last_post, initial),
		'open_stories': open_stories,
		'current_sprint': current_sprint,
		'sidebar_selected': 'mystuff',
	}

	return render_to_response('pages/my_stuff_fire.html', ctx, RequestContext(request))