<commit_before>import logging
log = logging.getLogger(__name__)

from rest_framework import (
    viewsets,
    permissions,
)

from drf_haystack.viewsets import HaystackViewSet

from .filters import (
    ConventionFilter,
    PersonFilter,
    GroupFilter,
    TuneFilter,
    VenueFilter,
)


from .models import (
    Arranger,
    Award,
    Catalog,
    Chapter,
    Contest,
    Contestant,
    Convention,
    Director,
    Group,
    Judge,
    Organization,
    Performance,
    Performer,
    Person,
    Round,
    Score,
    Session,
    Singer,
    Song,
    Tune,
    Venue,
)

from .serializers import (
    ArrangerSerializer,
    AwardSerializer,
    CatalogSerializer,
    ChapterSerializer,
    ContestSerializer,
    ContestantSerializer,
    ConventionSerializer,
    DirectorSerializer,
    GroupSearchSerializer,
    GroupSerializer,
    JudgeSerializer,
    OrganizationSerializer,
    PerformanceSerializer,
    PerformerSerializer,
    PersonSearchSerializer,
    PersonSerializer,
    RoundSerializer,
    ScoreSerializer,
    SessionSerializer,
    SingerSerializer,
    SongSerializer,
    TuneSerializer,
    VenueSerializer,
)


class ArrangerViewSet(viewsets.ModelViewSet):
    queryset = Arranger.objects.select_related(
        'catalog',
        'person',
    )
    serializer_class = ArrangerSerializer
    # lookup_field = 'slug'
    resource_name = "arranger"


class AwardViewSet(viewsets.ModelViewSet):
    queryset = Award.objects.select_related(
        'organization',
    )
    serializer_class = AwardSerializer
    # lookup_field = 'slug'
    resource_name = "award"


class ChapterViewSet(viewsets.ModelViewSet):
    queryset = Chapter.objects.select_related(
        'organization',
    )
    serializer_class = ChapterSerializer
    # lookup_field = 'slug'
    resource_name = "chapter"


class CatalogViewSet(viewsets.ModelViewSet):
    queryset = Catalog.objects.select_related(
        'tune',
    ).prefetch_related(
        'arrangers',
    )
    serializer_class = CatalogSerializer
    # lookup_field = 'slug'
    resource_name = "catalog"


class ContestViewSet(viewsets.ModelViewSet):
    queryset = Contest.objects.select_related(
        'session',
        'award',
        'parent',
    ).prefetch_related(
        'contestants',
    )
    serializer_class = ContestSerializer
    resource_name = 'contest'
    # lookup_field = 'slug'
    resource_name = "contest"


class ContestantViewSet(viewsets.ModelViewSet):
    queryset = Contestant.objects.select_related(
        'performer',
        'contest',
    )
    serializer_class = ContestantSerializer
    resource_name = 'contestant'
    # lookup_field = 'slug'
    resource_name = "contestant"


class SessionViewSet(viewsets.ModelViewSet):
    queryset = Session.objects.select_related(
        'convention',
        'administrator',
    ).prefetch_related(
        'performers',
        'rounds',
        'judges',
        'contests',
    )
    serializer_class = SessionSerializer
    # lookup_field = 'slug'
    resource_name = "session"


class PerformerViewSet(viewsets.ModelViewSet):
    queryset = Performer.objects.select_related(
        'session',
        'organization',
        'group',
    ).prefetch_related(
        'performances',
        'contestants',
        'directors',
        'singers',
    )
    serializer_class = PerformerSerializer
    # lookup_field = 'slug'
    resource_name = "performer"


class ConventionViewSet(viewsets.ModelViewSet):
    queryset = Convention.objects.select_related(
        'organization',
    ).prefetch_related(
        'sessions',
    )
    serializer_class = ConventionSerializer
    # lookup_field = 'slug'
    resource_name = "convention"
    filter_class = ConventionFilter<commit_msg>Add venue to views<commit_after>import logging
log = logging.getLogger(__name__)

from rest_framework import (
    viewsets,
    permissions,
)

from drf_haystack.viewsets import HaystackViewSet

from .filters import (
    ConventionFilter,
    PersonFilter,
    GroupFilter,
    TuneFilter,
    VenueFilter,
)


from .models import (
    Arranger,
    Award,
    Catalog,
    Chapter,
    Contest,
    Contestant,
    Convention,
    Director,
    Group,
    Judge,
    Organization,
    Performance,
    Performer,
    Person,
    Round,
    Score,
    Session,
    Singer,
    Song,
    Tune,
    Venue,
)

from .serializers import (
    ArrangerSerializer,
    AwardSerializer,
    CatalogSerializer,
    ChapterSerializer,
    ContestSerializer,
    ContestantSerializer,
    ConventionSerializer,
    DirectorSerializer,
    GroupSearchSerializer,
    GroupSerializer,
    JudgeSerializer,
    OrganizationSerializer,
    PerformanceSerializer,
    PerformerSerializer,
    PersonSearchSerializer,
    PersonSerializer,
    RoundSerializer,
    ScoreSerializer,
    SessionSerializer,
    SingerSerializer,
    SongSerializer,
    TuneSerializer,
    VenueSerializer,
)


class ArrangerViewSet(viewsets.ModelViewSet):
    queryset = Arranger.objects.select_related(
        'catalog',
        'person',
    )
    serializer_class = ArrangerSerializer
    # lookup_field = 'slug'
    resource_name = "arranger"


class AwardViewSet(viewsets.ModelViewSet):
    queryset = Award.objects.select_related(
        'organization',
    )
    serializer_class = AwardSerializer
    # lookup_field = 'slug'
    resource_name = "award"


class ChapterViewSet(viewsets.ModelViewSet):
    queryset = Chapter.objects.select_related(
        'organization',
    )
    serializer_class = ChapterSerializer
    # lookup_field = 'slug'
    resource_name = "chapter"


class CatalogViewSet(viewsets.ModelViewSet):
    queryset = Catalog.objects.select_related(
        'tune',
    ).prefetch_related(
        'arrangers',
    )
    serializer_class = CatalogSerializer
    # lookup_field = 'slug'
    resource_name = "catalog"


class ContestViewSet(viewsets.ModelViewSet):
    queryset = Contest.objects.select_related(
        'session',
        'award',
        'parent',
    ).prefetch_related(
        'contestants',
    )
    serializer_class = ContestSerializer
    resource_name = 'contest'
    # lookup_field = 'slug'
    resource_name = "contest"


class ContestantViewSet(viewsets.ModelViewSet):
    queryset = Contestant.objects.select_related(
        'performer',
        'contest',
    )
    serializer_class = ContestantSerializer
    resource_name = 'contestant'
    # lookup_field = 'slug'
    resource_name = "contestant"


class SessionViewSet(viewsets.ModelViewSet):
    queryset = Session.objects.select_related(
        'convention',
        'administrator',
    ).prefetch_related(
        'performers',
        'rounds',
        'judges',
        'contests',
    )
    serializer_class = SessionSerializer
    # lookup_field = 'slug'
    resource_name = "session"


class PerformerViewSet(viewsets.ModelViewSet):
    queryset = Performer.objects.select_related(
        'session',
        'organization',
        'group',
    ).prefetch_related(
        'performances',
        'contestants',
        'directors',
        'singers',
    )
    serializer_class = PerformerSerializer
    # lookup_field = 'slug'
    resource_name = "performer"


class ConventionViewSet(viewsets.ModelViewSet):
    queryset = Convention.objects.select_related(
        'organization',
        'venue',
    ).prefetch_related(
        'sessions',
    )
    serializer_class = ConventionSerializer
    # lookup_field = 'slug'
    resource_name = "convention"
    filter_class = ConventionFilter
{'fraction_non_alphanumeric': 0.08677795442501325, 'fraction_numerical': 0.0, 'mean_word_length': 2.9174883238194083, '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': '5158405', 'n_tokens_mistral': 2239, 'n_tokens_neox': 2223, 'n_words': 401}