def edit_task_in_list(request, storyID, taskID): story = mdl_story.get_story(storyID) task = mdl_task.get_task(taskID) project = story.project association = UserAssociation.objects.get( user=request.user, project=project ) if request.method == 'POST': form = TaskForm(request.POST, instance=task) if form.is_valid(): task = form.save(commit=True) else: form = TaskForm(instance=task) tasks = mdl_task.get_tasks_for_story(story) context = { 'story': story, 'tasks': tasks, 'task': task, 'editform': form, 'project': project, 'association': association } return render(request, 'TaskList.html', context)
def edit_task_in_list(request, storyID, taskID): story = mdl_story.get_story(storyID) task = mdl_task.get_task(taskID) project = story.project association = UserAssociation.objects.get( user=request.user, project=project) if request.method == 'POST': form = TaskForm(request.POST, instance=task) if form.is_valid(): task = form.save(commit=True) else: form = TaskForm(instance=task) tasks = mdl_task.get_tasks_for_story(story) context = { 'story': story, 'tasks': tasks, 'task': task, 'editform': form, 'project': project, 'association': association } return render(request, 'TaskList.html', context)
def list_tasks(request, storyID): story = mdl_story.get_story(storyID) tasks = mdl_task.get_tasks_for_story(story) form = TaskForm() context = {'story': story, 'tasks': tasks, 'newform': form} return render(request, 'TaskList.html', context)
def list_comments(request, storyID): story = mdl_story.get_story(storyID) comments = mdl_comment.get_comments_for_story(story) form = CommentForm() context = { 'story': story, 'comments': comments, 'newform': form } return render(request, 'CommentList.html', context)
def list_attachments(request, storyID): story = mdl_story.get_story(storyID) attachments = mdl_attachment.get_attachments_for_story(story) form = AttachmentForm() context = { 'attachments': attachments, 'newform': form, 'story': story } return render(request, 'AttachmentForm.html', context)
def list_attachments(request, storyID): story = mdl_story.get_story(storyID) attachments = mdl_attachment.get_attachments_for_story(story) form = AttachmentForm() context = { 'attachments': attachments, 'newform': form, 'story' : story } return render(request, 'AttachmentForm.html', context)
def upload_attachments_into_list(request, storyID): story = mdl_story.get_story(storyID) file = request.FILES['file_' + storyID] if request.method == 'POST': mdl_attachment.create(storyID, file) story.last_updated = datetime.datetime.now() story.save() attachments = mdl_attachment.get_attachments_for_story(story) context = {'attachments': attachments, 'story': story} return redirect(request.META['HTTP_REFERER'])
def remove_comment_from_list(request, storyID, commentID): story = mdl_story.get_story(storyID) comment = mdl_comment.get_comment(commentID) if request.method == 'POST': comment.delete() comments = mdl_comment.get_comments_for_story(story) form = CommentForm() context = {'story': story, 'comments': comments, 'newform': form} return render(request, 'CommentList.html', context)
def add_task_into_list(request, storyID): story = mdl_story.get_story(storyID) if request.method == 'POST': form = TaskForm(request.POST) if form.is_valid(): mdl_task.create_task(story, request.POST) else: form = TaskForm() tasks = mdl_task.get_tasks_for_story(story) context = {'story': story, 'tasks': tasks, 'newform': form} return render(request, 'TaskList.html', context)
def remove_task_from_list(request, storyID, taskID): story = mdl_story.get_story(storyID) task = mdl_task.get_task(taskID) if request.method == 'POST': task.delete() tasks = mdl_task.get_tasks_for_story(story) form = TaskForm() context = {'story': story, 'tasks': tasks, 'newform': form} return render(request, 'TaskList.html', context)
def add_comment_into_list(request, storyID): story = mdl_story.get_story(storyID) if request.method == 'POST': form = CommentForm(request.POST) if form.is_valid(): mdl_comment.create_comment(story, request.POST) else: form = CommentForm() comments = mdl_comment.get_comments_for_story(story) context = {'story': story, 'comments': comments, 'newform': form} return render(request, 'CommentList.html', context)
def list_tasks(request, storyID): story = mdl_story.get_story(storyID) project = story.project association = UserAssociation.objects.get(user=request.user,project=project) tasks = mdl_task.get_tasks_for_story(story) form = TaskForm() context = {'story': story, 'tasks': tasks, 'newform': form, 'project': project, 'association': association} return render(request, 'TaskList.html', context)
def edit_story(request, projectID, storyID): project = project_api.get_project(projectID) association = UserAssociation.objects.get(user=request.user, project=project) story = mdl_story.get_story(storyID) if story is None: # return redirect('/req/projectdetail/' + projectID) # return empty string and do the redirect stuff in front-end return HttpResponse('') if request.method == 'POST': form = StoryForm(request.POST, instance=story, project=project) if form.is_valid(): # <<<<<<< HEAD story = form.save(commit=False) formset = TaskFormSet(request.POST, instance=story) if formset.is_valid(): story.save() # 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) else: form = StoryForm(instance=story, project=project) formset = TaskFormSet(instance=story) numTasks = initTasks = mdl_task.get_tasks_for_story( story).count() # story.task_set.count() if numTasks == 0: numTasks = 1 else: numTasks = numTasks + 1 formset.extra = 1 context = { 'title': 'Edit User Story', 'project': project, 'association': association, 'title': 'Edit User Story', 'form': form, 'formset': formset, 'initTasks': formset.initial_form_count(), 'numTasks': formset.total_form_count(), 'action': '/req/editstory/' + projectID + '/' + storyID, 'button_desc': 'Save Changes' } return render(request, 'StorySummary.html', context)
def edit_story(request, projectID, storyID): project = project_api.get_project(projectID) association = UserAssociation.objects.get( user=request.user, project=project) story = mdl_story.get_story(storyID) if story is None: # return redirect('/req/projectdetail/' + projectID) # return empty string and do the redirect stuff in front-end return HttpResponse('') if request.method == 'POST': form = StoryForm(request.POST, instance=story, project=project) if form.is_valid(): # <<<<<<< HEAD story = form.save(commit=False) formset = TaskFormSet(request.POST, instance=story) if formset.is_valid(): story.save() # 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) else: form = StoryForm(instance=story, project=project) formset = TaskFormSet(instance=story) numTasks = initTasks = mdl_task.get_tasks_for_story( story).count() # story.task_set.count() if numTasks == 0: numTasks = 1 else: numTasks = numTasks + 1 formset.extra = 1 context = {'title': 'Edit User Story', 'project': project, 'association': association, 'title': 'Edit User Story', 'form': form, 'formset': formset, 'initTasks': formset.initial_form_count(), 'numTasks': formset.total_form_count(), 'action': '/req/editstory/' + projectID + '/' + storyID, 'button_desc': 'Save Changes'} return render(request, 'StorySummary.html', context)
def edit_story(request, projectID, storyID): project = project_api.get_project(projectID) association = UserAssociation.objects.get(user=request.user, project=project) story = mdl_story.get_story(storyID) if story == None: return redirect('/req/projectdetail/' + projectID) if request.method == 'POST': form = StoryForm(request.POST, instance=story, project=project) if form.is_valid(): # <<<<<<< HEAD # story = form.save(commit=False) # formset = TaskFormSet(request.POST, instance=story) # if formset.is_valid(): # story.save() # formset.save() # return redirect('/req/projects/' + projectID) # ======= story = form.save(commit=True) if not 'next' in request.POST: return redirect('/req/projectdetail/' + projectID) else: next = request.POST['next'] return redirect(next) # >>>>>>> newfeature-additerationdetail else: form = StoryForm(instance=story, project=project) # formset = TaskFormSet(instance=story) # if story.task_set.count() == 0: formset.extra = 1 # test that association and permissions are working # print "UserID "+str(request.user.id)+" and ProjectID "+projectID+" and storyID "+storyID # can_edit_hours = association.get_permission("EditHours") # should become unnecessary # str_edit_hours = str(can_edit_hours) # print "In association of user and project, permission EditHours is "+str_edit_hours context = { 'title': 'Edit User Story', 'project': project, 'association': association, 'title': 'Edit User Story', 'form': form, # 'formset' : formset, 'action': '/req/editstory/' + projectID + '/' + storyID, 'button_desc': 'Save Changes' } return render(request, 'StorySummary.html', context)
def upload_attachments_into_list (request, storyID): story = mdl_story.get_story(storyID) file = request.FILES['file_'+storyID] if request.method == 'POST': mdl_attachment.create(storyID, file) story.last_updated = datetime.datetime.now() story.save() attachments = mdl_attachment.get_attachments_for_story(story) context = { 'attachments': attachments, 'story' : story } return redirect(request.META['HTTP_REFERER'])
def add_task_into_list(request, storyID): story = mdl_story.get_story(storyID) if request.method == 'POST': form = TaskForm(request.POST) if form.is_valid(): mdl_task.create_task(story,request.POST) else: form = TaskForm() tasks = mdl_task.get_tasks_for_story(story) context = { 'story': story, 'tasks': tasks, 'newform': form } return render(request, 'TaskList.html', context)
def remove_comment_from_list(request, storyID, commentID): story = mdl_story.get_story(storyID) comment = mdl_comment.get_comment(commentID) if request.method == 'POST': comment.delete() comments = mdl_comment.get_comments_for_story(story) form = CommentForm() context = { 'story': story, 'comments': comments, 'newform': form } return render(request, 'CommentList.html', context)
def add_comment_into_list(request, storyID): story = mdl_story.get_story(storyID) if request.method == 'POST': form = CommentForm(request.POST) if form.is_valid(): mdl_comment.create_comment(story,request.POST) else: form = CommentForm() comments = mdl_comment.get_comments_for_story(story) context = { 'story': story, 'comments': comments, 'newform': form } return render(request, 'CommentList.html', context)
def list_tasks(request, storyID): story = mdl_story.get_story(storyID) project = story.project association = UserAssociation.objects.get(user=request.user, project=project) tasks = mdl_task.get_tasks_for_story(story) form = TaskForm() context = { 'story': story, 'tasks': tasks, 'newform': form, 'project': project, 'association': association } return render(request, 'TaskList.html', context)
def remove_task_from_list(request, storyID, taskID): story = mdl_story.get_story(storyID) task = mdl_task.get_task(taskID) if request.method == 'POST': task.delete() tasks = mdl_task.get_tasks_for_story(story) form = TaskForm() context = { 'story': story, 'tasks': tasks, 'newform': form } return render(request, 'TaskList.html', context)
def edit_story(request, projectID, storyID): project = project_api.get_project(projectID) association = UserAssociation.objects.get(user=request.user, project=project) story = mdl_story.get_story(storyID) if story == None: return redirect('/req/projectdetail/' + projectID) if request.method == 'POST': form = StoryForm(request.POST, instance=story, project=project) if form.is_valid(): # <<<<<<< HEAD # story = form.save(commit=False) # formset = TaskFormSet(request.POST, instance=story) # if formset.is_valid(): # story.save() # formset.save() # return redirect('/req/projects/' + projectID) # ======= story = form.save(commit=True) if not 'next' in request.POST: return redirect('/req/projectdetail/' + projectID) else: next = request.POST['next'] return redirect(next) # >>>>>>> newfeature-additerationdetail else: form = StoryForm(instance=story, project=project) # formset = TaskFormSet(instance=story) # if story.task_set.count() == 0: formset.extra = 1 # test that association and permissions are working # print "UserID "+str(request.user.id)+" and ProjectID "+projectID+" and storyID "+storyID # can_edit_hours = association.get_permission("EditHours") # should become unnecessary # str_edit_hours = str(can_edit_hours) # print "In association of user and project, permission EditHours is "+str_edit_hours context = {'title' : 'Edit User Story', 'project' : project, 'association' : association, 'title' : 'Edit User Story', 'form' : form, # 'formset' : formset, 'action' : '/req/editstory/' + projectID + '/' + storyID, 'button_desc' : 'Save Changes'} return render(request, 'StorySummary.html', context )
def edit_comment_in_list(request, storyID, commentID): story = mdl_story.get_story(storyID) comment = mdl_comment.get_comment(commentID) if request.method == 'POST': form = CommentForm(request.POST, instance=comment) if form.is_valid(): comment = form.save(commit=True) else: form = CommentForm(instance=comment) comments = mdl_comment.get_comments_for_story(story) context = { 'story': story, 'comments': comments, 'comment': comment, 'editform': form, } return render(request, 'CommentList.html', context)
def add_task_into_list(request, storyID): story = mdl_story.get_story(storyID) project = story.project association = UserAssociation.objects.get(user=request.user,project=project) if request.method == 'POST': form = TaskForm(request.POST) if form.is_valid(): mdl_task.create_task(story,request.POST) else: form = TaskForm() tasks = mdl_task.get_tasks_for_story(story) context = { 'story': story, 'tasks': tasks, 'newform': form, 'project': project, 'association': association } return render(request, 'TaskList.html', context)
def remove_task_from_list(request, storyID, taskID): story = mdl_story.get_story(storyID) task = mdl_task.get_task(taskID) project = story.project association = UserAssociation.objects.get(user=request.user,project=project) if request.method == 'POST': task.delete() tasks = mdl_task.get_tasks_for_story(story) form = TaskForm() context = { 'story': story, 'tasks': tasks, 'newform': form, 'project': project, 'association': association } return render(request, 'TaskList.html', context)
def edit_task_in_list(request, storyID, taskID): story = mdl_story.get_story(storyID) task = mdl_task.get_task(taskID) if request.method == 'POST': form = TaskForm(request.POST, instance=task) if form.is_valid(): task = form.save(commit=True) else: form = TaskForm(instance=task) tasks = mdl_task.get_tasks_for_story(story) context = { 'story': story, 'tasks': tasks, 'task': task, 'editform': form, } return render(request, 'TaskList.html', context)
def remove_task_from_list(request, storyID, taskID): story = mdl_story.get_story(storyID) task = mdl_task.get_task(taskID) project = story.project association = UserAssociation.objects.get(user=request.user, project=project) if request.method == 'POST': task.delete() tasks = mdl_task.get_tasks_for_story(story) form = TaskForm() context = { 'story': story, 'tasks': tasks, 'newform': form, 'project': project, 'association': association } return render(request, 'TaskList.html', context)
def add_task_into_list(request, storyID): story = mdl_story.get_story(storyID) project = story.project association = UserAssociation.objects.get(user=request.user, project=project) if request.method == 'POST': form = TaskForm(request.POST) if form.is_valid(): mdl_task.create_task(story, request.POST) else: form = TaskForm() tasks = mdl_task.get_tasks_for_story(story) context = { 'story': story, 'tasks': tasks, 'newform': form, 'project': project, 'association': association } return render(request, 'TaskList.html', context)
def move_story_to_icebox(request, projectID, storyID): story = mdl_story.get_story(storyID) mdl_iteration.move_story_to_icebox(story) return redirect('/req/projectdetail/' + projectID)
def move_story_to_iteration(request, projectID, storyID, iterationID): story = mdl_story.get_story(storyID) iteration = mdl_iteration.get_iteration(iterationID) mdl_iteration.move_story_to_iteration(story, iteration) return redirect('/req/projectdetail/' + projectID)
def edit_story(request, projectID, storyID): project = project_api.get_project(projectID) association = UserAssociation.objects.get(user=request.user, project=project) story = mdl_story.get_story(storyID) if story is None: # return redirect('/req/projectdetail/' + projectID) # return empty string and do the redirect stuff in front-end return HttpResponse('') if request.method == 'POST': form = StoryForm(request.POST, instance=story, project=project) if form.is_valid(): # <<<<<<< HEAD story = form.save(commit=False) formset = TaskFormSet(request.POST, instance=story) if formset.is_valid(): story.save() # formset.instance=story formset.save() # return redirect('/req/projects/' + projectID) # return empty string and do the redirect stuff in front-end return HttpResponse('') # ======= # story = form.save(commit=True) # if not 'next' in request.POST: # return redirect('/req/projectdetail/' + projectID) # else: # next = request.POST['next'] # return redirect(next) else: formset = TaskFormSet(request.POST, instance=story) # >>>>>>> newfeature-additerationdetail else: # <<<<<<< HEAD # form = StoryForm(instance=story, project=project) # formset = TaskFormSet(instance=story) # if story.task_set.count() == 0: formset.extra = 1 # test that association and permissions are working # print "UserID "+str(request.user.id)+" and ProjectID "+projectID+" and storyID "+storyID # can_edit_hours = association.get_permission("EditHours") # should become unnecessary # str_edit_hours = str(can_edit_hours) # print "In association of user and project, permission EditHours is "+str_edit_hours # ======= form = StoryForm(instance=story, project=project) formset = TaskFormSet(instance=story) numTasks = initTasks = mdl_task.get_tasks_for_story( story).count() # story.task_set.count() if numTasks == 0: numTasks = 1 else: numTasks = numTasks + 1 formset.extra = 1 # >>>>>>> newfeature-TasksFormset context = { 'title': 'Edit User Story', 'project': project, 'association': association, 'title': 'Edit User Story', 'form': form, # <<<<<<< HEAD # # 'formset' : formset, # 'action' : '/req/editstory/' + projectID + '/' + storyID, # 'button_desc' : 'Save Changes'} # ======= 'formset': formset, 'initTasks': formset.initial_form_count(), 'numTasks': formset.total_form_count(), 'action': '/req/editstory/' + projectID + '/' + storyID, 'button_desc': 'Save Changes' } # >>>>>>> newfeature-TasksFormset return render(request, 'StorySummary.html', context)
def edit_story(request, projectID, storyID): project = project_api.get_project(projectID) association = UserAssociation.objects.get( user=request.user, project=project) story = mdl_story.get_story(storyID) if story is None: # return redirect('/req/projectdetail/' + projectID) # return empty string and do the redirect stuff in front-end return HttpResponse('') if request.method == 'POST': form = StoryForm(request.POST, instance=story, project=project) if form.is_valid(): # <<<<<<< HEAD story = form.save(commit=False) formset = TaskFormSet(request.POST, instance=story) if formset.is_valid(): story.save() # formset.instance=story formset.save() # return redirect('/req/projects/' + projectID) # return empty string and do the redirect stuff in front-end return HttpResponse('') # ======= # story = form.save(commit=True) # if not 'next' in request.POST: # return redirect('/req/projectdetail/' + projectID) # else: # next = request.POST['next'] # return redirect(next) else: formset = TaskFormSet(request.POST, instance=story) # >>>>>>> newfeature-additerationdetail else: # <<<<<<< HEAD # form = StoryForm(instance=story, project=project) # formset = TaskFormSet(instance=story) # if story.task_set.count() == 0: formset.extra = 1 # test that association and permissions are working # print "UserID "+str(request.user.id)+" and ProjectID "+projectID+" and storyID "+storyID # can_edit_hours = association.get_permission("EditHours") # should become unnecessary # str_edit_hours = str(can_edit_hours) # print "In association of user and project, permission EditHours is "+str_edit_hours # ======= form = StoryForm(instance=story, project=project) formset = TaskFormSet(instance=story) numTasks = initTasks = mdl_task.get_tasks_for_story( story).count() # story.task_set.count() if numTasks == 0: numTasks = 1 else: numTasks = numTasks + 1 formset.extra = 1 # >>>>>>> newfeature-TasksFormset context = {'title': 'Edit User Story', 'project': project, 'association': association, 'title': 'Edit User Story', 'form': form, # <<<<<<< HEAD # # 'formset' : formset, # 'action' : '/req/editstory/' + projectID + '/' + storyID, # 'button_desc' : 'Save Changes'} # ======= 'formset': formset, 'initTasks': formset.initial_form_count(), 'numTasks': formset.total_form_count(), 'action': '/req/editstory/' + projectID + '/' + storyID, 'button_desc': 'Save Changes'} # >>>>>>> newfeature-TasksFormset return render(request, 'StorySummary.html', context)
def move_story_to_backlog(request, projectID, storyID): story = mdl_story.get_story(storyID) mdl_iteration.move_story_to_backlog(story) return redirect('/requirements/projectdetail/' + projectID)