Ejemplo n.º 1
0
def new_story(request, projectID):
    story = Story()
    project = project_api.get_project(projectID)
    association = UserAssociation.objects.get(user=request.user,
                                              project=project)
    if request.method == 'POST':
        form = StoryForm(request.POST, project=project)
        if form.is_valid():
            # <<<<<<< HEAD
            story = form.save(commit=False)
            formset = TaskFormSet(request.POST, instance=story)
            if formset.is_valid():
                story = mdl_story.create_story(project, request.POST)
                formset.instance = story
                formset.save()
                # return redirect('/req/projects/' + projectID)
                # return empty string and do the redirect stuff in front-end
                return HttpResponse('')
        else:
            formset = TaskFormSet(request.POST, instance=story)
            # formset.extra = 1
# =======
# story = mdl_story.create_story(project, request.POST)
# story = form.save(commit=False)
# if not 'next' in request.POST:
#     return redirect('/req/projectdetail/' + projectID)
# else:
#     next = request.POST['next']
#     return redirect(next)
# >>>>>>> newfeature-additerationdetail
    else:
        form = StoryForm(project=project)
        formset = TaskFormSet(instance=story)
        formset.extra = 1
    # project = project_api.get_project(projectID)
    # association = UserAssociation.objects.get(user=request.user, project=project)
    context = {
        'title': 'New User Story',
        'form': form,
        'project': project,
        'association': association,
        # <<<<<<< HEAD
        #                # 'formset' : formset,
        #                'action' : '/req/newstory/' + projectID ,
        #                'button_desc' : 'Create User Story',
        #                 }
        #     return render(request, 'StorySummary.html', context )
        # =======
        'formset': formset,
        'initTasks': formset.initial_form_count(),
        'numTasks': formset.total_form_count(),
        'action': '/req/newstory/' + projectID,
        'button_desc': 'Create User Story'
    }
    return render(request, 'StorySummary.html', context)
Ejemplo n.º 2
0
def new_story(request, projectID):
    story = Story()
    project = project_api.get_project(projectID)
    association = UserAssociation.objects.get(
        user=request.user,
        project=project)
    if request.method == 'POST':
        form = StoryForm(request.POST, project=project)
        if form.is_valid():
            # <<<<<<< HEAD
            story = form.save(commit=False)
            formset = TaskFormSet(request.POST, instance=story)
            if formset.is_valid():
                story = mdl_story.create_story(project, request.POST)
                formset.instance = story
                formset.save()
                # return redirect('/req/projects/' + projectID)
                # return empty string and do the redirect stuff in front-end
                return HttpResponse('')
        else:
            formset = TaskFormSet(request.POST, instance=story)
            # formset.extra = 1
# =======
            # story = mdl_story.create_story(project, request.POST)
            # story = form.save(commit=False)
            # if not 'next' in request.POST:
            #     return redirect('/req/projectdetail/' + projectID)
            # else:
            #     next = request.POST['next']
            #     return redirect(next)
# >>>>>>> newfeature-additerationdetail
    else:
        form = StoryForm(project=project)
        formset = TaskFormSet(instance=story)
        formset.extra = 1
    # project = project_api.get_project(projectID)
    # association = UserAssociation.objects.get(user=request.user, project=project)
    context = {'title': 'New User Story',
               'form': form,
               'project': project,
               'association': association,
               # <<<<<<< HEAD
               #                # 'formset' : formset,
               #                'action' : '/req/newstory/' + projectID ,
               #                'button_desc' : 'Create User Story',
               #                 }
               #     return render(request, 'StorySummary.html', context )
               # =======
               'formset': formset,
               'initTasks': formset.initial_form_count(),
               'numTasks': formset.total_form_count(),
               'action': '/req/newstory/' + projectID,
               'button_desc': 'Create User Story'}
    return render(request, 'StorySummary.html', context)
def new_story(request, projectID):
    story = Story()
    project = project_api.get_project(projectID)
    association = UserAssociation.objects.get(
        user=request.user,
        project=project)
    if request.method == 'POST':
        form = StoryForm(request.POST, project=project)

        if form.is_valid():
            story = form.save(commit=False)
            formset = TaskFormSet(request.POST, instance=story)
            if formset.is_valid():
                story = mdl_story.create_story(project, request.POST)
                formset.instance = story
                formset.save()
                # return empty string and do the redirect stuff in front-end
                return HttpResponse('')
        else:
            formset = TaskFormSet(request.POST, instance=story)
    else:
        form = StoryForm(project=project)
        formset = TaskFormSet(instance=story)
        formset.extra = 1
    context = {
        'title': 'New User Story',
        'form': form,
        'project': project,
        'association': association,

        'formset': formset,
        'initTasks': formset.initial_form_count(),
        'numTasks': formset.total_form_count(),
        'action': '/requirements/newstory/' + projectID,
        'button_desc': 'Create User Story'
    }
    return render(request, 'StorySummary.html', context)