Exemplo n.º 1
0
    def add_redmine_activity(project,sprintusertoryForm, request, object):
        bugtracking = BugTrackingFactory.getConnection(project=project)
        try:
            version = sprintusertoryForm[0].sprint.reference
        except:
            version = 1
        artType = ArtifactType.objects.filter(
            level=3
        ).first()
        if request.is_secure():
            url = 'https://' + get_current_site(request).domain + str(
                reverse_lazy('main:userstory-detail', kwargs={'pk': object.pk}))
        else:
            url = 'http://' + get_current_site(request).domain + str(
                reverse_lazy('main:userstory-detail', kwargs={'pk': object.pk}))

        issue = bugtracking.addIssueFromUserStory(
            project_id=project.id,
            subject=object.title + ' ' + artType.trace_code + object.code,
            tracker_id=project.issueOnInsertUserStory,
            description=object.description + ' ' + url,
            fixed_version_id=version,
        )


        userstory = UserStory.objects.filter(project=project, code=object.code).get()
        Artifact.objects.create(project=project,
                                reference=issue.id,
                                type=artType,
                                userstory=userstory)
Exemplo n.º 2
0
    def add_redmine_activity(project, sprintusertoryForm, request, object):
        bugtracking = BugTrackingFactory.getConnection(project=project)
        try:
            version = sprintusertoryForm[0].sprint.reference
        except:
            version = 1
        artType = ArtifactType.objects.filter(level=3).first()
        if request.is_secure():
            url = 'https://' + get_current_site(request).domain + str(
                reverse_lazy('main:userstory-detail', kwargs={'pk': object.pk
                                                              }))
        else:
            url = 'http://' + get_current_site(request).domain + str(
                reverse_lazy('main:userstory-detail', kwargs={'pk': object.pk
                                                              }))

        issue = bugtracking.addIssueFromUserStory(
            project_id=project.id,
            subject=object.title + ' ' + artType.trace_code + object.code,
            tracker_id=project.issueOnInsertUserStory,
            description=object.description + ' ' + url,
            fixed_version_id=version,
        )

        userstory = UserStory.objects.filter(project=project,
                                             code=object.code).get()
        Artifact.objects.create(project=project,
                                reference=issue.id,
                                type=artType,
                                userstory=userstory)
Exemplo n.º 3
0
    def sprint_to_userstory(project):
        bugtracking = BugTrackingFactory.getConnection(project=project)
        userStories = UserStory.objects.filter(project=project)
        log = []
        for us in userStories:
            spuss = None
            try:
                issue = bugtracking.getIssue(us.reference)
            except:
                issue = None

            try:
                version = issue.fixed_version
            except:
                version = None

            try:
                issuestatus = issue.status.id
            except:
                issuestatus = None

            if issuestatus is not None and issuestatus == project.issueStatusClosed:
                issuestatus = 1
            else:
                issuestatus = 0



            if issue is not None:
                spuss = SprintUserStory.objects.filter(userstory=us)

                if spuss.count()>0:
                    isNew = False
                    for spus in spuss:
                        if spus.sprint.reference != version.id:
                            isNew = True
                        else:
                           isNew = False
                    if isNew:
                        SprintUserStory.objects.create(
                            sprint=Sprint.objects.get(project=project, reference=version),
                            userstory=us,
                            status=issuestatus,
                        )
                        log.append(_('Userstory added to Sprint'))
                    else:
                        sprintUs = SprintUserStory.objects.get(sprint__project=project, sprint__reference=version, userstory=us)
                        sprintUs.status = issuestatus
                        sprintUs.save()
                        log.append(_('Userstory updated to Sprint'))
                else:
                    if version is not None:
                        SprintUserStory.objects.create(
                            sprint=Sprint.objects.get(project=project, reference=version),
                            userstory=us,
                            status=issuestatus,
                        )
                        log.append(_('Userstory added to Sprint'))
        return log
Exemplo n.º 4
0
 def _get_time(project, issue):
     spent_time = 0
     for time_entry in issue.time_entries:
         spent_time += time_entry.hours
     try:
         estimated_time = issue.estimated_hours
     except:
         try:
             bugtracking = BugTrackingFactory.getConnection(project=project)
             iss = bugtracking.getIssue(issue.id)
             estimated_time = iss.total_estimated_hours  # bug in python-redmine dont take estimated_hours in getIssues
         except:
             estimated_time = 0
     return {
         'spent_time' : spent_time,
         'estimated_time' : estimated_time,
     }
Exemplo n.º 5
0
 def _get_time(project, issue):
     spent_time = 0
     for time_entry in issue.time_entries:
         spent_time += time_entry.hours
     try:
         estimated_time = issue.estimated_hours
     except:
         try:
             bugtracking = BugTrackingFactory.getConnection(project=project)
             iss = bugtracking.getIssue(issue.id)
             estimated_time = iss.total_estimated_hours  # bug in python-redmine dont take estimated_hours in getIssues
         except:
             estimated_time = 0
     return {
         'spent_time': spent_time,
         'estimated_time': estimated_time,
     }
Exemplo n.º 6
0
    def get_userstories_from_bugtracking(project):
        bugtracking = BugTrackingFactory.getConnection(project=project)
        bugtrackingUserStories = bugtracking.getUserStories(
            project.issueTypesAsUserStory)
        log = []

        for bugtrackuserstory in bugtrackingUserStories:
            try:
                userstory = UserStory.objects.get(
                    project=project, reference=bugtrackuserstory.id)
            except UserStory.DoesNotExist:
                userstory = None

            if userstory is None:
                numUserStories = UserStory.objects.filter(
                    project=project).count()
                UserStory.objects.create(
                    code='US' + str(numUserStories + 1),
                    reference=bugtrackuserstory.id,
                    title=bugtrackuserstory.subject,
                    description=bugtrackuserstory.description,
                    project=project,
                )
                log.append(
                    _('Created UserStory: ') + 'US' + str(numUserStories + 1))

                #ja adiciona como artefato do tipo atividade
                ArtifactService._add_artifact(project, bugtrackuserstory)
            else:
                #update user story
                userstory.title = bugtrackuserstory.subject
                userstory.description = bugtrackuserstory.description
                userstory.save()
                log.append(_('Updated UserStory: ') + 'US' + userstory.code)

                # ja adiciona ou altera como artefato do tipo atividade
                ArtifactService._add_artifact(project, bugtrackuserstory)

        return log
Exemplo n.º 7
0
    def get_sprints_from_bugtracking(project):
        bugtracking = BugTrackingFactory.getConnection(project=project)
        bugtrackingSprints = bugtracking.getSprints()
        log = []
        for bugtrackingsprint in bugtrackingSprints:
            try:
                sprint = Sprint.objects.get(project=project,
                                            reference=bugtrackingsprint.id)
            except Sprint.DoesNotExist:
                sprint = None

            if sprint is None:
                #create sprint data
                if bugtrackingsprint.status == 'Closed':
                    status = 2
                else:
                    status = 1

                Sprint.objects.create(
                    title=bugtrackingsprint.name,
                    reference=bugtrackingsprint.id,
                    status=status,
                    project=project,
                )
                log.append(_('Created Sprint: ') + bugtrackingsprint.name)
            else:
                #update sprint
                # create sprint data
                if bugtrackingsprint.status == 'Closed':
                    status = 2
                else:
                    status = 1
                sprint.title = bugtrackingsprint.name
                sprint.status = status
                sprint.save()
                log.append(_('Updated Sprint: ') + bugtrackingsprint.name)

        return log
Exemplo n.º 8
0
    def get_sprints_from_bugtracking(project):
        bugtracking = BugTrackingFactory.getConnection(project=project)
        bugtrackingSprints = bugtracking.getSprints()
        log = []
        for bugtrackingsprint in bugtrackingSprints:
            try:
                sprint = Sprint.objects.get(project=project, reference=bugtrackingsprint.id)
            except Sprint.DoesNotExist:
                sprint = None

            if  sprint is None:
                #create sprint data
                if bugtrackingsprint.status=='Closed':
                    status = 2
                else:
                    status = 1

                Sprint.objects.create(
                    title=bugtrackingsprint.name,
                    reference=bugtrackingsprint.id,
                    status=status,
                    project=project,
                )
                log.append(_('Created Sprint: ') + bugtrackingsprint.name)
            else:
                #update sprint
                # create sprint data
                if bugtrackingsprint.status == 'Closed':
                    status = 2
                else:
                    status = 1
                sprint.title = bugtrackingsprint.name
                sprint.status = status
                sprint.save()
                log.append(_('Updated Sprint: ')+bugtrackingsprint.name)

        return log
Exemplo n.º 9
0
    def get_userstories_from_bugtracking(project):
        bugtracking = BugTrackingFactory.getConnection(project=project)
        bugtrackingUserStories = bugtracking.getUserStories(project.issueTypesAsUserStory)
        log = []

        for bugtrackuserstory in bugtrackingUserStories:
            try:
                userstory = UserStory.objects.get(project=project, reference=bugtrackuserstory.id)
            except UserStory.DoesNotExist:
                userstory = None

            if userstory is None:
                numUserStories = UserStory.objects.filter(project=project).count()
                UserStory.objects.create(
                    code = 'US'+str(numUserStories+1),
                    reference = bugtrackuserstory.id,
                    title = bugtrackuserstory.subject,
                    description = bugtrackuserstory.description,
                    project=project,
                )
                log.append(_('Created UserStory: ') + 'US'+str(numUserStories+1))


                #ja adiciona como artefato do tipo atividade
                ArtifactService._add_artifact(project, bugtrackuserstory)
            else:
                #update user story
                userstory.title =  bugtrackuserstory.subject
                userstory.description = bugtrackuserstory.description
                userstory.save()
                log.append(_('Updated UserStory: ') + 'US' + userstory.code)

                # ja adiciona ou altera como artefato do tipo atividade
                ArtifactService._add_artifact(project, bugtrackuserstory)

        return log
Exemplo n.º 10
0
    def get_bugtrack_activities(project, get_sprintuserstory=False):
        bugtracking = BugTrackingFactory.getConnection(project=project)
        artifactsTypes = ArtifactType.objects.filter(project=project, type=2, )

        tracking_sp_planned_variable = project.tracking_sp_planned_variable
        tracking_sp_realized_variable = project.tracking_sp_realized_variable
        tracking_bv_planned_variable = project.tracking_bv_planned_variable
        tracking_bv_realized_variable = project.tracking_bv_realized_variable
        if tracking_sp_planned_variable == '':
            tracking_sp_planned_variable = False
        if tracking_sp_realized_variable == '':
            tracking_sp_realized_variable = False
        if tracking_bv_planned_variable == '':
            tracking_bv_planned_variable = False
        if tracking_bv_realized_variable == '':
            tracking_bv_realized_variable = False

        acfinder = activityFinder(bugtracking, artifactsTypes,
                                  tracking_sp_planned_variable, tracking_sp_realized_variable,
                                  tracking_bv_planned_variable, tracking_bv_realized_variable,
                                  )

        references = []
        log = []
        for artifact in acfinder.artifactList:
            references.append(str(artifact['reference'])+' ')
            try:
                filterArtifact = Artifact.objects.get(project=project, reference=artifact['reference'])
            except Artifact.DoesNotExist:
                filterArtifact = None

            try:
                if not filterArtifact is None:
                    # upldate a exist artifact
                    if artifact['artifactType'].level == 0:
                        filterArtifact.type = artifact['artifactType']
                        filterArtifact.title = artifact['title']
                        filterArtifact.description = artifact['description']
                        filterArtifact.save()
                    elif artifact['artifactType'].level == 1:
                        requeriment = Requeriment.objects.filter(project=project, code=artifact['code']).get()
                        filterArtifact.type = artifact['artifactType']
                        filterArtifact.title = artifact['title']
                        filterArtifact.description = artifact['description']
                        filterArtifact.requeriment = requeriment
                        filterArtifact.save()
                    elif artifact['artifactType'].level == 2:
                        sprint = Sprint.objects.filter(project=project, code=artifact['code']).get()
                        filterArtifact.type = artifact['artifactType']
                        filterArtifact.title = artifact['title']
                        filterArtifact.description = artifact['description']
                        filterArtifact.sprint = sprint
                        filterArtifact.save()
                    elif artifact['artifactType'].level == 3:
                        userstory = UserStory.objects.filter(project=project, code=artifact['code']).get()
                        filterArtifact.estimated_time = artifact['estimated_time']
                        filterArtifact.spent_time = artifact['spent_time']
                        filterArtifact.type = artifact['artifactType']
                        filterArtifact.title = artifact['title']
                        filterArtifact.description = artifact['description']
                        filterArtifact.estimated_storypoints = artifact['estimated_storypoints']
                        filterArtifact.realized_storypoints = artifact['realized_storypoints']
                        filterArtifact.estimated_businnesvalue = artifact['estimated_businnesvalue']
                        filterArtifact.realized_businnesvalue = artifact['realized_businnesvalue']
                        filterArtifact.userstory = userstory
                        filterArtifact.save()
                        log.append(_('Updated Artifact:')+artifact['code']+' '+_('Reference: ')+str(artifact['reference']))
                        if not SprintUserStory.objects.filter(sprint__project=project, userstory=userstory, sprint__reference=artifact['version'].id).count():
                            SprintUserStory.objects.create(
                                sprint=Sprint.objects.get(project=project, reference=artifact['version'].id),
                                userstory=userstory,
                            )
                            log.append(_('Userstory added to Sprint'))
                else:
                    # create a new artifact
                    if artifact['artifactType'].level == 0:
                        Artifact.objects.create(project=project,
                                                reference=artifact['reference'],
                                                type=artifact['artifactType'],
                                                title=artifact['title'],
                                                description=artifact['description'],
                                                )
                    elif artifact['artifactType'].level == 1:
                        requeriment = Requeriment.objects.filter(project=project, code=artifact['code']).get()
                        Artifact.objects.create(project=project,
                                                reference=artifact['reference'],
                                                type=artifact['artifactType'],
                                                requeriment=requeriment,
                                                title=artifact['title'],
                                                description=artifact['description'],
                                                )
                    elif artifact['artifactType'].level == 2:
                        sprint = Sprint.objects.filter(project=project, code=artifact['code']).get()
                        Artifact.objects.create(project=project,
                                                reference=artifact['reference'],
                                                type=artifact['artifactType'],
                                                sprint=sprint,
                                                title=artifact['title'],
                                                description=artifact['description'],
                                                )
                    elif artifact['artifactType'].level == 3:
                        userstory = UserStory.objects.filter(project=project, code=artifact['code']).get()
                        Artifact.objects.create(project=project,
                                                reference=artifact['reference'],
                                                estimated_time=artifact['estimated_time'],
                                                spent_time=artifact['spent_time'],
                                                estimated_storypoints=artifact['estimated_storypoints'],
                                                realized_storypoints=artifact['realized_storypoints'],
                                                estimated_businnesvalue=artifact['estimated_businnesvalue'],
                                                realized_businnesvalue=artifact['realized_businnesvalue'],
                                                type=artifact['artifactType'],
                                                userstory=userstory,
                                                title=artifact['title'],
                                                description=artifact['description'],)
                    if get_sprintuserstory:
                        if not SprintUserStory.objects.filter(sprint__project=project, userstory=userstory, sprint__reference=artifact['version'].id).count():
                            SprintUserStory.objects.create(
                                sprint=Sprint.objects.get(project=project, reference=artifact['version'].id),
                                userstory=userstory,
                            )
                            log.append(_('Userstory added to Sprint'))


                    log.append(_('Created Artifact: ')+artifact['code']+' '+_('Reference: ')+str(artifact['reference']))
            except:
                log.append("====>ERRO: "+ str(artifact['reference'])+' '+artifact['code'])
        """Artifact.objects.exclude(reference__in=references).exclude(reference="''").filter(project=project,
                                                                                          type__type=2, ).delete()"""  # delete the artifacts not detected in bugtracking
        return log
Exemplo n.º 11
0
    def get_bugtrack_activities(project, get_sprintuserstory=False):
        bugtracking = BugTrackingFactory.getConnection(project=project)
        artifactsTypes = ArtifactType.objects.filter(
            project=project,
            type=2,
        )

        tracking_sp_planned_variable = project.tracking_sp_planned_variable
        tracking_sp_realized_variable = project.tracking_sp_realized_variable
        tracking_bv_planned_variable = project.tracking_bv_planned_variable
        tracking_bv_realized_variable = project.tracking_bv_realized_variable
        if tracking_sp_planned_variable == '':
            tracking_sp_planned_variable = False
        if tracking_sp_realized_variable == '':
            tracking_sp_realized_variable = False
        if tracking_bv_planned_variable == '':
            tracking_bv_planned_variable = False
        if tracking_bv_realized_variable == '':
            tracking_bv_realized_variable = False

        acfinder = activityFinder(
            bugtracking,
            artifactsTypes,
            tracking_sp_planned_variable,
            tracking_sp_realized_variable,
            tracking_bv_planned_variable,
            tracking_bv_realized_variable,
        )

        references = []
        log = []
        for artifact in acfinder.artifactList:
            references.append(str(artifact['reference']) + ' ')
            try:
                filterArtifact = Artifact.objects.get(
                    project=project, reference=artifact['reference'])
            except Artifact.DoesNotExist:
                filterArtifact = None

            try:
                if not filterArtifact is None:
                    # upldate a exist artifact
                    if artifact['artifactType'].level == 0:
                        filterArtifact.type = artifact['artifactType']
                        filterArtifact.title = artifact['title']
                        filterArtifact.description = artifact['description']
                        filterArtifact.save()
                    elif artifact['artifactType'].level == 1:
                        requeriment = Requeriment.objects.filter(
                            project=project, code=artifact['code']).get()
                        filterArtifact.type = artifact['artifactType']
                        filterArtifact.title = artifact['title']
                        filterArtifact.description = artifact['description']
                        filterArtifact.requeriment = requeriment
                        filterArtifact.save()
                    elif artifact['artifactType'].level == 2:
                        sprint = Sprint.objects.filter(
                            project=project, code=artifact['code']).get()
                        filterArtifact.type = artifact['artifactType']
                        filterArtifact.title = artifact['title']
                        filterArtifact.description = artifact['description']
                        filterArtifact.sprint = sprint
                        filterArtifact.save()
                    elif artifact['artifactType'].level == 3:
                        userstory = UserStory.objects.filter(
                            project=project, code=artifact['code']).get()
                        filterArtifact.estimated_time = artifact[
                            'estimated_time']
                        filterArtifact.spent_time = artifact['spent_time']
                        filterArtifact.type = artifact['artifactType']
                        filterArtifact.title = artifact['title']
                        filterArtifact.description = artifact['description']
                        filterArtifact.estimated_storypoints = artifact[
                            'estimated_storypoints']
                        filterArtifact.realized_storypoints = artifact[
                            'realized_storypoints']
                        filterArtifact.estimated_businnesvalue = artifact[
                            'estimated_businnesvalue']
                        filterArtifact.realized_businnesvalue = artifact[
                            'realized_businnesvalue']
                        filterArtifact.userstory = userstory
                        filterArtifact.save()
                        log.append(
                            _('Updated Artifact:') + artifact['code'] + ' ' +
                            _('Reference: ') + str(artifact['reference']))
                        if not SprintUserStory.objects.filter(
                                sprint__project=project,
                                userstory=userstory,
                                sprint__reference=artifact['version'].id
                        ).count():
                            SprintUserStory.objects.create(
                                sprint=Sprint.objects.get(
                                    project=project,
                                    reference=artifact['version'].id),
                                userstory=userstory,
                            )
                            log.append(_('Userstory added to Sprint'))
                else:
                    # create a new artifact
                    if artifact['artifactType'].level == 0:
                        Artifact.objects.create(
                            project=project,
                            reference=artifact['reference'],
                            type=artifact['artifactType'],
                            title=artifact['title'],
                            description=artifact['description'],
                        )
                    elif artifact['artifactType'].level == 1:
                        requeriment = Requeriment.objects.filter(
                            project=project, code=artifact['code']).get()
                        Artifact.objects.create(
                            project=project,
                            reference=artifact['reference'],
                            type=artifact['artifactType'],
                            requeriment=requeriment,
                            title=artifact['title'],
                            description=artifact['description'],
                        )
                    elif artifact['artifactType'].level == 2:
                        sprint = Sprint.objects.filter(
                            project=project, code=artifact['code']).get()
                        Artifact.objects.create(
                            project=project,
                            reference=artifact['reference'],
                            type=artifact['artifactType'],
                            sprint=sprint,
                            title=artifact['title'],
                            description=artifact['description'],
                        )
                    elif artifact['artifactType'].level == 3:
                        userstory = UserStory.objects.filter(
                            project=project, code=artifact['code']).get()
                        Artifact.objects.create(
                            project=project,
                            reference=artifact['reference'],
                            estimated_time=artifact['estimated_time'],
                            spent_time=artifact['spent_time'],
                            estimated_storypoints=artifact[
                                'estimated_storypoints'],
                            realized_storypoints=artifact[
                                'realized_storypoints'],
                            estimated_businnesvalue=artifact[
                                'estimated_businnesvalue'],
                            realized_businnesvalue=artifact[
                                'realized_businnesvalue'],
                            type=artifact['artifactType'],
                            userstory=userstory,
                            title=artifact['title'],
                            description=artifact['description'],
                        )
                    if get_sprintuserstory:
                        if not SprintUserStory.objects.filter(
                                sprint__project=project,
                                userstory=userstory,
                                sprint__reference=artifact['version'].id
                        ).count():
                            SprintUserStory.objects.create(
                                sprint=Sprint.objects.get(
                                    project=project,
                                    reference=artifact['version'].id),
                                userstory=userstory,
                            )
                            log.append(_('Userstory added to Sprint'))

                    log.append(
                        _('Created Artifact: ') + artifact['code'] + ' ' +
                        _('Reference: ') + str(artifact['reference']))
            except:
                log.append("====>ERRO: " + str(artifact['reference']) + ' ' +
                           artifact['code'])
        """Artifact.objects.exclude(reference__in=references).exclude(reference="''").filter(project=project,
                                                                                          type__type=2, ).delete()"""  # delete the artifacts not detected in bugtracking
        return log
Exemplo n.º 12
0
    def sprint_to_userstory(project):
        bugtracking = BugTrackingFactory.getConnection(project=project)
        userStories = UserStory.objects.filter(project=project)
        log = []
        for us in userStories:
            spuss = None
            try:
                issue = bugtracking.getIssue(us.reference)
            except:
                issue = None

            try:
                version = issue.fixed_version
            except:
                version = None

            try:
                issuestatus = issue.status.id
            except:
                issuestatus = None

            if issuestatus is not None and issuestatus == project.issueStatusClosed:
                issuestatus = 1
            else:
                issuestatus = 0

            if issue is not None:
                spuss = SprintUserStory.objects.filter(userstory=us)

                if spuss.count() > 0:
                    isNew = False
                    for spus in spuss:
                        if spus.sprint.reference != version.id:
                            isNew = True
                        else:
                            isNew = False
                    if isNew:
                        SprintUserStory.objects.create(
                            sprint=Sprint.objects.get(project=project,
                                                      reference=version),
                            userstory=us,
                            status=issuestatus,
                        )
                        log.append(_('Userstory added to Sprint'))
                    else:
                        sprintUs = SprintUserStory.objects.get(
                            sprint__project=project,
                            sprint__reference=version,
                            userstory=us)
                        sprintUs.status = issuestatus
                        sprintUs.save()
                        log.append(_('Userstory updated to Sprint'))
                else:
                    if version is not None:
                        SprintUserStory.objects.create(
                            sprint=Sprint.objects.get(project=project,
                                                      reference=version),
                            userstory=us,
                            status=issuestatus,
                        )
                        log.append(_('Userstory added to Sprint'))
        return log
Exemplo n.º 13
0
    def get_context_data(self, **kwargs):
        context = super(ArtifactActivityView, self).get_context_data(**kwargs)
        artifact = get_object_or_404(
            Artifact,
            project=self.request.session.get('project_id', None),
            id=self.kwargs['artifact']
        )

        project = get_object_or_404(
            Project.objects.all(),
            id=self.request.session.get('project_id', None),
        )
        bugtracking = BugTrackingFactory.getConnection(project=project)
        issue = bugtracking.getIssue(artifact.reference)
        context['artifact']=artifact
        context['issue']=issue
        context['project']=project

        if 'pk' in self.kwargs:  # userstory
            userstory = get_object_or_404(UserStory, pk=self.kwargs['pk'])
            context['page_title'] = _('Userstory Artifact')
            if 'sprint_id' in self.kwargs:
                sprint = get_object_or_404(Sprint, pk=self.kwargs['sprint_id'])
                context['breadcrumbs'] = (
                    {'link': reverse_lazy('main:home'), 'class': '', 'name': _('Home')},
                    {'link': reverse_lazy('main:sprint'), 'class': '', 'name': _('Sprint')},
                    {'link': reverse_lazy('main:sprint-details', kwargs={'sprint_id': self.kwargs['sprint_id']}),
                     'class': '', 'name': sprint},
                    {'link': reverse_lazy('main:sprint-userstory', kwargs={'sprint_id': self.kwargs['sprint_id']}),
                     'class': '',
                     'name': _('User Stories')},
                    {'link': reverse_lazy('main:userstory-detail', kwargs={'pk': userstory.pk}), 'class': '',
                     'name': userstory.code},
                    {'link': reverse_lazy('main:artifact', kwargs={'pk': userstory.pk, 'sprint_id': self.kwargs['sprint_id']}),
                        'class': '', 'name': _('Artifacts')},
                    {'link': '#','class': '', 'name': _('Artifact')},
                )
            elif 'requeriment_id' in self.kwargs:
                requeriment = get_object_or_404(Requeriment, pk=self.kwargs['requeriment_id'])
                context['breadcrumbs'] = (
                    {'link': reverse_lazy('main:home'), 'class': '', 'name': _('Home')},
                    {'link': reverse_lazy('main:requeriment'), 'class': '', 'name': _('Requeriments')},
                    {'link': reverse_lazy('main:requeriment-details', kwargs={'pk': self.kwargs['requeriment_id']}),
                     'class': '', 'name': requeriment},
                    {'link': reverse_lazy('main:requeriment-userstory',
                                          kwargs={'requeriment_id': self.kwargs['requeriment_id']}), 'class': '',
                     'name': _('User Stories')},
                    {'link': reverse_lazy('main:requeriment-userstory-detail',
                                          kwargs={'requeriment_id': self.kwargs['requeriment_id'], 'pk': userstory.pk}),
                     'class': '',
                     'name': userstory.code},
                    {'link': reverse_lazy('main:artifact',
                                          kwargs={'pk': userstory.pk, 'requeriment_id': self.kwargs['requeriment_id']}),
                     'class': '', 'name': _('Artifacts')},
                    {'link': '#', 'class': '', 'name': _('Artifact')},
                )
            else:
                context['breadcrumbs'] = (
                    {'link': reverse_lazy('main:home'), 'class': '', 'name': _('Home')},
                    {'link': reverse_lazy('main:userstory'), 'class': '',
                     'name': _('User Stories')},
                    {'link': reverse_lazy('main:userstory-detail', kwargs={'pk': userstory.pk}), 'class': '',
                     'name': userstory.code},
                    {'link': reverse_lazy('main:artifact',
                                          kwargs={'pk': userstory.pk}),
                     'class': '', 'name': _('Artifacts')},
                    {'link': '#', 'class': '', 'name': _('Artifact')},
                )
        elif 'sprint_id' in self.kwargs:
            sprint = get_object_or_404(Sprint, pk=self.kwargs['sprint_id'])
            context['page_title'] = _('Sprint Artifacts')
            context['breadcrumbs'] = (
                {'link': reverse_lazy('main:home'), 'class': '', 'name': _('Home')},
                {'link': reverse_lazy('main:sprint'), 'class': '', 'name': _('Sprint')},
                {'link': reverse_lazy('main:sprint-details', kwargs={'sprint_id': sprint.id}), 'class': '',
                 'name': sprint},
                {'link': '#', 'class': '', 'name': _('Artifact')},
            )
        elif 'requeriment_id' in self.kwargs:
            requeriment = get_object_or_404(Requeriment, pk=self.kwargs['requeriment_id'])
            context['page_title'] = _('Requeriment Artifacts')
            context['breadcrumbs'] = (
                {'link': reverse_lazy('main:home'), 'class': '', 'name': _('Home')},
                {'link': reverse_lazy('main:requeriment'), 'class': '', 'name': _('Requeriment')},
                {'link': reverse_lazy('main:requeriment-details', kwargs={'pk': requeriment.id}), 'class': '',
                 'name': requeriment.code},
                {'link': '#', 'class': '', 'name': _('Artifacts')},
            )
        else:
            context['breadcrumbs'] = (
                {'link': reverse_lazy('main:home'), 'class': '', 'name': _('Home')},
                {'link': reverse_lazy('main:artifact'), 'class': '', 'name': _('Project Artifacts')},
                {'link': '#', 'class': '', 'name': _('Artifact')},
            )
            context['page_title'] = _('Project Artifact')

        return context