from rest_framework_gis.filters import InBBoxFilter
from django_filters.rest_framework import DjangoFilterBackend
class InBBoxHTMLMixin:
template = """
{% load i18n %}
{% trans "BBox filter" %}
"""
def to_html(self, request, queryset, view):
return template_render(
Template(self.template), {'bbox_param': self.bbox_param}, request
)
class CustomBBoxFilter(InBBoxHTMLMixin, InBBoxFilter):
bbox_param = 'position_bbox'
class CustomViewSet(ModelViewSet):
filter_backends = (CustomBBoxFilter, DjangoFilterBackend,)