<commit_before>
from rest_framework.filters import (
    FilterSet
)
from csacompendium.research.models import Research


class ResearchListFilter(FilterSet):
    """
    Filter query list from research database
    """
    class Meta:
        model = Research
        fields = {
            'experiment_design': ['iexact', 'icontains'],
            'object_id': ['exact'],
            'content_type': ['exact'],<commit_msg>Added and commented ContentType filterset<commit_after>
from rest_framework.filters import (
    FilterSet
)
from csacompendium.research.models import Research

# Test for ContentType filter. To be used if need be
# from csacompendium.csa_practice.models import ResearchCsaPractice
# from django.contrib.contenttypes.models import ContentType

import django_filters


class ResearchListFilter(FilterSet):
    """
    Filter query list from research database
    """

    # Test for ContentType filter. To be used if need be by adding to Meta fields
    # def _csa_practice_filter(qs, value):
    #     research = Research.objects.all()
    #     research_ctype = ContentType.objects.get_for_model(Research)
    #     if value:
    #         try:
    #             research_csa_practice = ResearchCsaPractice.objects.filter(
    #                 content_type=research_ctype,
    #                 object_id__in=[i.id for i in research]
    #             ).filter(csapractice__practice_code=value)
    #         except ResearchCsaPractice.DoesNotExist:
    #             return None
    #         return qs.filter(id__in=[i.id for i in research_csa_practice])
    #     return qs
    # csa_practice = django_filters.CharFilter(action=_csa_practice_filter)

    class Meta:
        model = Research
        fields = {
            'experiment_design': ['iexact', 'icontains'],
            'object_id': ['exact'],
            'content_type': ['exact'],
{'fraction_non_alphanumeric': 0.08867521367521368, 'fraction_numerical': 0.0, 'mean_word_length': 2.672549019607843, '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': '3305207', 'n_tokens_mistral': 548, 'n_tokens_neox': 519, 'n_words': 129}