<commit_before>from rest_framework import renderers

from sightings.views.sightings import SightingViewSet
from locations.views import GridTileViewSet
from keadatabase.pagination import SightingGeoJSONPagination, GridTileGeoJSONPagination
from .serializers import SightingGeoJSONSerializer, GridTileGeoJSONSerializer

class SightingGeoJSONViewSet(SightingViewSet):
    serializer_class = SightingGeoJSONSerializer
    pagination_class = SightingGeoJSONPagination

    # Disable HTML view of this for compatibility
    renderer_classes = [renderers.JSONRenderer]

class GridTileGeoJSONViewSet(GridTileViewSet):
    serializer_class = GridTileGeoJSONSerializer
    pagination_class = GridTileGeoJSONPagination

    # Disable HTML view of this for compatibility
    renderer_classes = [renderers.JSONRenderer]<commit_msg>Added tile filtering by TMS<commit_after>from rest_framework import renderers
from rest_framework_gis.filters import TMSTileFilter

from sightings.views.sightings import SightingViewSet
from locations.views import GridTileViewSet
from keadatabase.pagination import SightingGeoJSONPagination, GridTileGeoJSONPagination
from .serializers import SightingGeoJSONSerializer, GridTileGeoJSONSerializer

class SightingGeoJSONViewSet(SightingViewSet):
    serializer_class = SightingGeoJSONSerializer
    pagination_class = SightingGeoJSONPagination

    # Disable HTML view of this for compatibility
    renderer_classes = [renderers.JSONRenderer]

class GridTileGeoJSONViewSet(GridTileViewSet):
    serializer_class = GridTileGeoJSONSerializer
    pagination_class = GridTileGeoJSONPagination

    bbox_filter_field = 'polygon'
    filter_backends = (TMSTileFilter, )
    bbox_filter_include_overlapping = True

    # Disable HTML view of this for compatibility
    renderer_classes = [renderers.JSONRenderer]
{'fraction_non_alphanumeric': 0.03789126853377265, 'fraction_numerical': 0.0, 'mean_word_length': 6.623430962343096, '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': '2808420', 'n_tokens_mistral': 524, 'n_tokens_neox': 510, 'n_words': 117}