Пример #1
0
    def get_context_data(self, **kwargs):
        context = super(MaintainerListView, self).get_context_data(**kwargs)

        context['this_url_name'] = resolve(self.request.path_info).url_name

        context['all_maintplans'] = MaintenancePlan.objects.all()
        context['maintplan_name'] = self.maintplan_name
        maintplan = get_object_or_404(MaintenancePlan,
                                      name=self.maintplan_name)
        context['release_name'] = self.release_name
        context['all_releases'] = Release.objects.filter(
            plan=maintplan).order_by('-end_date')
        context['milestone_name'] = self.milestone_name
        context['all_milestones'] = Milestone.get_by_release_name(
            maintplan, self.release_name)

        context['recipes_percentage'] = self.milestone_statistics['percentage']
        context['recipes_all_upgraded'] = self.milestone_statistics[
            'all_upgraded']
        context['recipes_all_not_upgraded'] = self.milestone_statistics[
            'all_not_upgraded']
        context['recipes_up_to_date'] = self.milestone_statistics['up_to_date']
        context['recipes_not_updated'] = self.milestone_statistics[
            'not_updated']
        context['recipes_cant_be_updated'] = self.milestone_statistics[
            'cant_be_updated']
        context['recipes_unknown'] = self.milestone_statistics['unknown']
        context['recipes_percentage_up_to_date'] = \
            self.milestone_statistics['percentage_up_to_date']
        context['recipes_percentage_not_updated'] = \
            self.milestone_statistics['percentage_not_updated']
        context['recipes_percentage_cant_be_updated'] = \
            self.milestone_statistics['percentage_cant_be_updated']
        context['recipes_percentage_unknown'] = \
            self.milestone_statistics['percentage_unknown']

        context['maintainer_count'] = self.maintainer_count
        context['intervals'] = self.intervals
        context['interval_range'] = range(len(self.intervals))
        if hasattr(self, 'current_interval'):
            context['current_interval'] = self.current_interval

        return context
Пример #2
0
    def get_context_data(self, **kwargs):
        context = super(RecipeListView, self).get_context_data(**kwargs)

        context['this_url_name'] = resolve(self.request.path_info).url_name

        context['all_maintplans'] = MaintenancePlan.objects.all()
        context['maintplan_name'] = self.maintplan_name
        maintplan = get_object_or_404(MaintenancePlan,
                                      name=self.maintplan_name)
        context['maintplan'] = maintplan
        context['release_name'] = self.release_name
        context['all_releases'] = Release.objects.filter(
            plan=maintplan).order_by('-end_date')
        context['milestone_name'] = self.milestone_name
        context['all_milestones'] = Milestone.get_by_release_name(
            maintplan, self.release_name)

        current = date.today()
        current_release = Release.get_by_date(maintplan, current)
        if current_release:
            current_milestone = Milestone.get_by_release_and_date(
                current_release, current)
            if not current_milestone:
                messages.error(
                    self.request,
                    'There is no milestone defined in the latest release (%s) that covers the current date, so data shown here is not up-to-date. The administrator will need to create a milestone in order to fix this.'
                    % current_release)
        else:
            messages.error(
                self.request,
                'There is no release defined that covers the current date, so data shown here is not up-to-date. The administrator will need to create a release (and corresponding milestones) in order to fix this.'
            )

        context['recipes_percentage'] = self.milestone_statistics['percentage']
        context['recipes_all_upgraded'] = self.milestone_statistics[
            'all_upgraded']
        context['recipes_all_not_upgraded'] = self.milestone_statistics[
            'all_not_upgraded']
        context['recipes_up_to_date'] = self.milestone_statistics['up_to_date']
        context['recipes_not_updated'] = self.milestone_statistics[
            'not_updated']
        context['recipes_cant_be_updated'] = self.milestone_statistics[
            'cant_be_updated']
        context['recipes_unknown'] = self.milestone_statistics['unknown']
        context['recipes_percentage_up_to_date'] = \
            self.milestone_statistics['percentage_up_to_date']
        context['recipes_percentage_not_updated'] = \
            self.milestone_statistics['percentage_not_updated']
        context['recipes_percentage_cant_be_updated'] = \
            self.milestone_statistics['percentage_cant_be_updated']
        context['recipes_percentage_unknown'] = \
            self.milestone_statistics['percentage_unknown']

        context['recipe_list_count'] = self.recipe_list_count

        context['upstream_status'] = self.upstream_status
        ruch = RecipeUpstream.RECIPE_UPSTREAM_STATUS_CHOICES_DICT
        context['upstream_status_set_choices'] = [ruch['A']]
        context['upstream_status_choices'] = [
            ruch['N'], ruch['C'], ruch['Y'], ruch['U']
        ]

        context['maintainer_name'] = self.maintainer_name
        context['set_maintainers'] = ['All', 'No maintainer']
        all_maintainers = []
        for layerbranch_id, rmh in self.recipe_maintainer_history.items():
            for rm in RecipeMaintainer.objects.filter(
                    history=rmh).values('maintainer__name').distinct(
                    ).order_by('maintainer__name'):
                if rm['maintainer__name'] in context['set_maintainers']:
                    continue
                all_maintainers.append(rm['maintainer__name'])
        context['all_maintainers'] = all_maintainers

        context['search'] = self.search

        return context