<commit_before># Django
from django.views.generic import ListView
from chat.models import Message
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator

# Local Django
from user.decorators import is_health_professional


@method_decorator(login_required, name='dispatch')
@method_decorator(is_health_professional, name='dispatch')
class ArchiveBoxHealthProfessionalView(ListView):
    '''
    View for list messages in inbox.
    '''

    template_name = 'archive_health_professional.html'
    context_object_name = 'inbox'
    model = Message
    paginate_by = 40

    # Return all Messages for the user.
    def get_queryset(self):
        query_to = self.model.objects.filter(user_to=self.request.user, is_active=False)
        query_from = self.model.objects.filter(user_from=self.request.user, is_active=False)
        return self.model.objects.union(query_to, query_from)<commit_msg>#104 - Fixing bug in query.<commit_after># Django
from django.views.generic import ListView
from chat.models import Message
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator

# Local Django
from user.decorators import is_health_professional


@method_decorator(login_required, name='dispatch')
@method_decorator(is_health_professional, name='dispatch')
class ArchiveBoxHealthProfessionalView(ListView):
    '''
    View for list messages in inbox.
    '''

    template_name = 'archive_health_professional.html'
    context_object_name = 'inbox'
    model = Message
    paginate_by = 40

    # Return all Messages for the user.
    def get_queryset(self):
        query_to = self.model.objects.filter(user_to=self.request.user, is_active=False)
        query_from = self.model.objects.filter(user_from=self.request.user, is_active=False)
        records = (query_to | query_from).distinct()
        return records
{'fraction_non_alphanumeric': 0.08541666666666667, 'fraction_numerical': 0.0036458333333333334, 'mean_word_length': 4.683431952662722, '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': '2894143', 'n_tokens_mistral': 587, 'n_tokens_neox': 545, 'n_words': 127}