def get_context_data(self, **kwargs): context = super(ActivityListView, self).get_context_data(**kwargs) project = ProjectService.get_project(self.request.session['project_id']) context['project'] = project context['open_myactivities'] = ArtifactService.get_activities(self.request.session['project_id'], True, self.request.user.id, True) context['open_otheractivities'] = ArtifactService.get_activities(self.request.session['project_id'], True, self.request.user.id, False) return context
def form_valid(self, form, sprint_userstory_form): project = ProjectService.get_project(self.request.session['project_id']) form.instance.changed_by = self.request.user form.instance.project = project self.object = form.save() sprint_userstory_form.instance = self.object spus = sprint_userstory_form.save() #save new redmine issue related to userstory and artifact related if project.issueOnInsertUserStory: ArtifactService.add_redmine_activity(project,spus, self.request, self.object) return HttpResponseRedirect(self.get_success_url())
class ArtifactDeleteView(SuccessMessageMixin, DeleteView): """ #class:US009 """ model = ArtifactService.get_model() template_name = 'artifact/delete.html' fields = ('name', 'type', 'title', 'description', 'reference', 'requeriment','sprint','userstory','file') def get_success_url(self): requeriment_id = False sprint_id = False userstory_id = False if 'requeriment_id' in self.kwargs: requeriment_id = self.kwargs['requeriment_id'] if 'sprint_id' in self.kwargs: sprint_id = self.kwargs['sprint_id'] if 'userstory' in self.kwargs: userstory_id = self.kwargs['userstory'] return activity_sucess_url(requeriment_id, sprint_id, userstory_id) @method_decorator(require_project()) def dispatch(self, request, *args, **kwargs): return super(ArtifactDeleteView, self).dispatch(request, *args, **kwargs) def get_context_data(self, **kwargs): context = super(ArtifactDeleteView, self).get_context_data() return context
def get_context_data(self, **kwargs): context = super(ArtifactTraceBugTrackingView, self).get_context_data(**kwargs) project = ProjectService.get_project(self.request.session.get('project_id', None)) if project.versionAsSprint: context['sprintImportLogs'] = ArtifactService.get_sprints_from_bugtracking(project) context['artifactImportLogs'] = ArtifactService.get_bugtrack_activities(project, True) else: context['artifactImportLogs'] = ArtifactService.get_bugtrack_activities(project) if project.issueTypesAsUserStory: context['userStoryImportLogs'] = ArtifactService.get_userstories_from_bugtracking(project) context['sprintUsertory'] = ArtifactService.sprint_to_userstory(project) context['project'] = project return context
def ArtifactDownloadView(request, pk, location=None): """ #class:US009 Download """ artifact = ArtifactService.get_artifact(request.session.get('project_id', None), pk) filename = artifact.file.name.split('/')[-1] response = HttpResponse(artifact.file, content_type='text/plain') response['Content-Disposition'] = 'attachment; filename=%s' % filename return response
def get_context_data(self, **kwargs): context = super(HomeView, self).get_context_data(**kwargs) context['total_sprints'] = ProjectService.get_num_sprints_from_project(self.request.session.get('project_id', None)) context['total_requeriments'] = ProjectService.get_num_requeriments_from_project(self.request.session.get('project_id', None)) context['task_effort'] = SprintService.task_effort(self.request.session.get('project_id', None)) context['storypoints_variation'] = SprintService.storypoint(self.request.session.get('project_id', None)) context['project'] = ProjectService.get_project(self.request.session['project_id']) context['total_realized_storypoints'] = ArtifactService.total_realized_storyPoints(self.request.session.get('project_id', None)) context['total_userstories'] = ProjectService.get_num_userstories_from_project(self.request.session.get('project_id', None)) context['total_artifacts'] = ProjectService.get_num_artifacts_from_project(self.request.session.get('project_id', None)) return context
def get_context_data(self, **kwargs): context = super(HomeView, self).get_context_data(**kwargs) context['total_sprints'] = ProjectService.get_num_sprints_from_project( self.request.session.get('project_id', None)) context[ 'total_requeriments'] = ProjectService.get_num_requeriments_from_project( self.request.session.get('project_id', None)) context['task_effort'] = SprintService.task_effort( self.request.session.get('project_id', None)) context['storypoints_variation'] = SprintService.storypoint( self.request.session.get('project_id', None)) context['project'] = ProjectService.get_project( self.request.session['project_id']) context[ 'total_realized_storypoints'] = ArtifactService.total_realized_storyPoints( self.request.session.get('project_id', None)) context[ 'total_userstories'] = ProjectService.get_num_userstories_from_project( self.request.session.get('project_id', None)) context[ 'total_artifacts'] = ProjectService.get_num_artifacts_from_project( self.request.session.get('project_id', None)) return context
class ActivityUpdateFormView(UpdateFormView): """ #class:US015 """ page_title = _('Activity') model = ArtifactService.get_model() success_message = _('Activity was updated successfully') breadcrumbs = ( {'link': reverse_lazy('main:home'), 'class': '', 'name': _('Home')}, {'link': reverse_lazy('main:sprint'), 'class': '', 'name': _('Sprint')}, {'link': '#', 'class': '', 'name': _('Add')}, ) form_class = None tabs = None def get_form_class(self): if 'userstory' in self.kwargs: self.tabs = ( {"title": _("Activity"), "id": "activity", "class": "active", "fields": ('user', 'title', 'description', 'type', 'userstory',)}, {"title": _("Time"), "id": "time", "fields": ('create_date', 'estimated_time', 'closed_date', 'spent_time')}, {"title": _("Points"), "id": "points", "fields": ('estimated_storypoints', 'realized_storypoints')}, {"title": "BV", "id": "bv", "fields": ('estimated_businnesvalue', 'realized_businnesvalue')}, ) form = ActivityUserStoryForm elif 'sprint_id' in self.kwargs and 'requeriment_id' not in self.kwargs: self.tabs = ( {"title": _("Activity"), "id": "activity", "class": "active", "fields": ('user', 'title', 'description', 'type', 'sprint',)}, {"title": _("Time"), "id": "time", "fields": ('create_date', 'estimated_time', 'closed_date', 'spent_time')}, {"title": _("Points"), "id": "points", "fields": ('estimated_storypoints', 'realized_storypoints')}, {"title": "BV", "id": "bv", "fields": ('estimated_businnesvalue', 'realized_businnesvalue')}, ) form = ActivitySprintForm elif 'requeriment_id' in self.kwargs: self.tabs = ( {"title": _("Activity"), "id": "activity", "class": "active", "fields": ('user', 'title', 'description', 'type', 'requeriment',)}, {"title": _("Time"), "id": "time", "fields": ('create_date', 'estimated_time', 'closed_date', 'spent_time')}, {"title": _("Points"), "id": "points", "fields": ('estimated_storypoints', 'realized_storypoints')}, {"title": "BV", "id": "bv", "fields": ('estimated_businnesvalue', 'realized_businnesvalue')}, ) form = ActivityRequerimentForm else: self.tabs = ( {"title": _("Activity"), "id": "activity", "class": "active", "fields": ('user', 'title', 'description', 'type', )}, {"title": _("Time"), "id": "time", "fields": ('create_date', 'estimated_time', 'closed_date', 'spent_time')}, {"title": _("Points"), "id": "points", "fields": ('estimated_storypoints', 'realized_storypoints')}, {"title": "BV", "id": "bv", "fields": ('estimated_businnesvalue', 'realized_businnesvalue')}, ) form = ActivityProjectForm return form def get_form(self, *args, **kwargs): form = super(ActivityUpdateFormView, self).get_form(*args, **kwargs) if 'userstory' in self.kwargs: form.fields['type'].queryset = ArtifactTypeService.get_artifactstype(self.request.session['project_id'], 3, 2) elif 'sprint_id' in self.kwargs and 'requeriment_id' not in self.kwargs: form.fields['type'].queryset = ArtifactTypeService.get_artifactstype(self.request.session['project_id'], 2, 2) elif 'requeriment_id' in self.kwargs: form.fields['type'].queryset = ArtifactTypeService.get_artifactstype(self.request.session['project_id'], 1, 2) else: form.fields['type'].queryset = ArtifactTypeService.get_artifactstype(self.request.session['project_id'], 0, 2) if self.request.user.is_superuser: form.fields['user'].queryset = ProjectService.get_users_from_project(self.request.session['project_id']) return form def get_success_url(self): if 'back' in self.kwargs: return reverse_lazy('main:artifact-list-activity') requeriment_id = False sprint_id = False userstory_id = False if 'requeriment_id' in self.kwargs: requeriment_id = self.kwargs['requeriment_id'] if 'sprint_id' in self.kwargs: sprint_id = self.kwargs['sprint_id'] if 'userstory' in self.kwargs: userstory_id = self.kwargs['userstory'] return activity_sucess_url(requeriment_id, sprint_id, userstory_id) @method_decorator(require_project()) def dispatch(self, request, *args, **kwargs): return super(ActivityUpdateFormView, self).dispatch(request, *args, **kwargs) def form_valid(self, form): project = ProjectService.get_project(self.request.session['project_id']) #form.instance.changed_by = self.request.user form.instance.project = project return super(ActivityUpdateFormView, self).form_valid(form) def get_context_data(self, **kwargs): context = super(ActivityUpdateFormView, self).get_context_data(**kwargs) userstory_id = False sprint_id = False requeriment_id = False if 'userstory' in self.kwargs: #userstory userstory_id = self.kwargs['userstory'] if 'sprint_id' in self.kwargs: sprint_id = self.kwargs['sprint_id'] if 'requeriment_id' in self.kwargs: requeriment_id = self.kwargs['requeriment_id'] context['breadcrumbs'] = userstories_breadcrumbs(self.request.session['project_id'], requeriment_id, sprint_id, userstory_id, _('Update Activity')) return context