<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib import messages
from django.core.urlresolvers import reverse_lazy, reverse
from django.http import HttpResponseRedirect
from django.views.generic.detail import DetailView
from django.views.generic.edit import DeleteView
from django_filters.views import FilterView
from pola.views import ActionView
from braces.views import LoginRequiredMixin
from . import models
from .filters import ReportFilter


class ReportListView(LoginRequiredMixin, FilterView):
    model = models.Report
    filterset_class = ReportFilter
    paginate_by = 25
    queryset = models.Report.objects.all().prefetch_related('attachment_set')


class ReportAdvancedListView(LoginRequiredMixin, FilterView):
    model = models.Report
    filterset_class = ReportFilter
    paginate_by = 25
    template_name_suffix = '_filter_adv'
    queryset = models.Report.objects.all().prefetch_related('attachment_set')

    def post(self, request, *args, **kwargs):
        messages.success(request, "Raporty zostały skasowane")
        ids = request.POST.getlist('report_to_delete')
        models.Report.objects.filter(pk__in=ids).delete()
        return HttpResponseRedirect(reverse('report:advanced'))


class ReportDelete(LoginRequiredMixin, DeleteView):
    model = models.Report
    success_url = reverse_lazy('report:list')

<commit_msg>Resolve report instead delete it<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib import messages
from django.core.urlresolvers import reverse_lazy, reverse
from django.http import HttpResponseRedirect
from django.views.generic.detail import DetailView
from django.views.generic.edit import DeleteView
from django_filters.views import FilterView
from pola.views import ActionView
from braces.views import LoginRequiredMixin
from . import models
from .filters import ReportFilter


class ReportListView(LoginRequiredMixin, FilterView):
    model = models.Report
    filterset_class = ReportFilter
    paginate_by = 25
    queryset = models.Report.objects.all().prefetch_related('attachment_set')


class ReportAdvancedListView(LoginRequiredMixin, FilterView):
    model = models.Report
    filterset_class = ReportFilter
    paginate_by = 25
    template_name_suffix = '_filter_adv'
    queryset = models.Report.objects.all().prefetch_related('attachment_set')

    def post(self, request, *args, **kwargs):
        messages.success(request, "Raporty zostały skasowane")
        ids = request.POST.getlist('report_to_delete')
        models.Report.objects.filter(pk__in=ids).resolve(self.request.user)
        return HttpResponseRedirect(reverse('report:advanced'))


class ReportDelete(LoginRequiredMixin, DeleteView):
    model = models.Report
    success_url = reverse_lazy('report:list')


{'fraction_non_alphanumeric': 0.08906305664410402, 'fraction_numerical': 0.003562522265764161, 'mean_word_length': 4.9115789473684215, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3255165', 'n_tokens_mistral': 799, 'n_tokens_neox': 772, 'n_words': 182}