예제 #1
0
    def wipe_all_versions(self, request, queryset):
        """Wipe indexes of all versions of selected projects."""
        qs_iterator = queryset.iterator()
        for project in qs_iterator:
            version_qs = Version.internal.filter(project=project)
            if not version_qs.exists():
                self.message_user(
                    request,
                    'No active versions of project {}.'.format(project),
                    messages.ERROR)
            else:
                html_objs_qs = []
                for version in version_qs.iterator():
                    html_objs = HTMLFile.objects.filter(project=project,
                                                        version=version)

                    if html_objs.exists():
                        html_objs_qs.append(html_objs)

                if html_objs_qs:
                    _indexing_helper(html_objs_qs, wipe=True)

                self.message_user(
                    request,
                    'Task initiated successfully for {}.'.format(project),
                    messages.SUCCESS)
예제 #2
0
    def reindex_active_versions(self, request, queryset):
        """Reindex all active versions of the selected projects to ES."""
        qs_iterator = queryset.iterator()
        for project in qs_iterator:
            version_qs = Version.objects.filter(project=project)
            active_versions = version_qs.filter(active=True)

            if not active_versions.exists():
                self.message_user(
                    request,
                    'No active versions of project {}'.format(project),
                    messages.ERROR)
            else:
                html_objs_qs = []
                for version in active_versions.iterator():
                    html_objs = HTMLFile.objects.filter(project=project,
                                                        version=version)

                    if html_objs.exists():
                        html_objs_qs.append(html_objs)

                if html_objs_qs:
                    _indexing_helper(html_objs_qs, wipe=False)

                self.message_user(
                    request,
                    'Task initiated successfully for {}'.format(project),
                    messages.SUCCESS)
예제 #3
0
    def wipe_all_versions(self, request, queryset):
        """Wipe indexes of all versions of selected projects."""
        qs_iterator = queryset.iterator()
        for project in qs_iterator:
            version_qs = Version.objects.filter(project=project)
            if not version_qs.exists():
                self.message_user(
                    request,
                    'No active versions of project {}.'.format(project),
                    messages.ERROR
                )
            else:
                html_objs_qs = []
                for version in version_qs.iterator():
                    html_objs = HTMLFile.objects.filter(project=project, version=version)

                    if html_objs.exists():
                        html_objs_qs.append(html_objs)

                if html_objs_qs:
                    _indexing_helper(html_objs_qs, wipe=True)

                self.message_user(
                    request,
                    'Task initiated successfully for {}.'.format(project),
                    messages.SUCCESS
                )
예제 #4
0
    def reindex_active_versions(self, request, queryset):
        """Reindex all active versions of the selected projects to ES."""
        qs_iterator = queryset.iterator()
        for project in qs_iterator:
            version_qs = Version.objects.filter(project=project)
            active_versions = version_qs.filter(active=True)

            if not active_versions.exists():
                self.message_user(
                    request,
                    'No active versions of project {}'.format(project),
                    messages.ERROR
                )
            else:
                html_objs_qs = []
                for version in active_versions.iterator():
                    html_objs = HTMLFile.objects.filter(project=project, version=version)

                    if html_objs.exists():
                        html_objs_qs.append(html_objs)

                if html_objs_qs:
                    _indexing_helper(html_objs_qs, wipe=False)

                self.message_user(
                    request,
                    'Task initiated successfully for {}'.format(project),
                    messages.SUCCESS
                )
예제 #5
0
    def reindex_version(self, request, queryset):
        """Reindexes all selected versions to ES."""
        html_objs_qs = []
        for version in queryset.iterator():
            html_objs = HTMLFile.objects.filter(project=version.project,
                                                version=version)

            if html_objs.exists():
                html_objs_qs.append(html_objs)

        if html_objs_qs:
            _indexing_helper(html_objs_qs, wipe=False)

        self.message_user(request, 'Task initiated successfully.',
                          messages.SUCCESS)
예제 #6
0
    def reindex_version(self, request, queryset):
        """Reindexes all selected versions to ES."""
        html_objs_qs = []
        for version in queryset.iterator():
            html_objs = HTMLFile.objects.filter(project=version.project, version=version)

            if html_objs.exists():
                html_objs_qs.append(html_objs)

        if html_objs_qs:
            _indexing_helper(html_objs_qs, wipe=False)

        self.message_user(
            request,
            'Task initiated successfully.',
            messages.SUCCESS
        )
예제 #7
0
    def wipe_version_indexes(self, request, queryset):
        """Wipe selected versions from ES."""
        html_objs_qs = []
        for version in queryset.iterator():
            html_objs = HTMLFile.objects.filter(project=version.project,
                                                version=version)

            if html_objs.exists():
                html_objs_qs.append(html_objs)

        if html_objs_qs:
            _indexing_helper(html_objs_qs, wipe=True)

        self.message_user(
            request,
            'Task initiated successfully',
            messages.SUCCESS,
        )