<commit_before>#!/usr/bin/python
# -*- coding: utf-8 -*-

from rest_framework import viewsets
from rest_framework.filters import DjangoObjectPermissionsFilter

from .. import (
    models,
    permissions,
)
from ..serializers import (
    primarykey as serializers
)


class MovieViewSet(viewsets.ReadOnlyModelViewSet):
    queryset = models.Movie.objects.all()
    serializer_class = serializers.MovieSerializer


class GenreViewSet(viewsets.ReadOnlyModelViewSet):
    queryset = models.Genre.objects.all()
    serializer_class = serializers.GenreSerializer


class WatchlistViewSet(viewsets.ModelViewSet):
    queryset = models.Watchlist.objects.all()
    serializer_class = serializers.WatchlistSerializer
    filter_backends = [
        DjangoObjectPermissionsFilter,
    ]
    permission_classes = [
        permissions.DjangoObjectPermissions,
    ]


class ResumeViewSet(viewsets.ModelViewSet):
    queryset = models.Resume.objects.all()
    serializer_class = serializers.ResumeSerializer
    filter_backends = [
        DjangoObjectPermissionsFilter,
    ]
    permission_classes = [
        permissions.DjangoObjectPermissions,
    ]


class RatingViewSet(viewsets.ModelViewSet):
    queryset = models.Rating.objects.all()
    serializer_class = serializers.RatingSerializer<commit_msg>Add ordering filters for primary key based api.<commit_after>#!/usr/bin/python
# -*- coding: utf-8 -*-

from rest_framework import viewsets, filters

from .. import (
    models,
    permissions,
)
from ..serializers import (
    primarykey as serializers
)


class MovieViewSet(viewsets.ReadOnlyModelViewSet):
    queryset = models.Movie.objects.all()
    serializer_class = serializers.MovieSerializer
    filter_backends = (
        filters.OrderingFilter,
    )
    ordering_fields = (
        'title',
        'released',
        'runtime',
    )


class GenreViewSet(viewsets.ReadOnlyModelViewSet):
    queryset = models.Genre.objects.all()
    serializer_class = serializers.GenreSerializer
    filter_backends = (
        filters.OrderingFilter,
    )
    ordering_fields = (
        'name',
    )


class WatchlistViewSet(viewsets.ModelViewSet):
    queryset = models.Watchlist.objects.all()
    serializer_class = serializers.WatchlistSerializer
    filter_backends = (
        filters.DjangoObjectPermissionsFilter,
    )
    permission_classes = (
        permissions.DjangoObjectPermissions,
    )


class ResumeViewSet(viewsets.ModelViewSet):
    queryset = models.Resume.objects.all()
    serializer_class = serializers.ResumeSerializer
    filter_backends = (
        filters.DjangoObjectPermissionsFilter,
    )
    permission_classes = (
        permissions.DjangoObjectPermissions,
    )


class RatingViewSet(viewsets.ModelViewSet):
    queryset = models.Rating.objects.all()
    serializer_class = serializers.RatingSerializer
{'fraction_non_alphanumeric': 0.08544303797468354, 'fraction_numerical': 0.0007032348804500703, 'mean_word_length': 3.56661316211878, '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': '2340966', 'n_tokens_mistral': 820, 'n_tokens_neox': 817, 'n_words': 131}