deschler/django-modeltranslation

Not works with drf-yasg

karonator opened this issue · 1 comments

Any ideas, please?
Super simple model with just one text field...

backend-backend-1   | Internal Server Error: /swagger/
backend-backend-1   | Traceback (most recent call last):
backend-backend-1   |   File "/usr/local/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
backend-backend-1   |     response = get_response(request)
backend-backend-1   |   File "/usr/local/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
backend-backend-1   |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
backend-backend-1   |   File "/usr/local/lib/python3.8/site-packages/sentry_sdk/integrations/django/views.py", line 79, in sentry_wrapped_callback
backend-backend-1   |     return callback(request, *args, **kwargs)
backend-backend-1   |   File "/usr/local/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
backend-backend-1   |     return view_func(*args, **kwargs)
backend-backend-1   |   File "/usr/local/lib/python3.8/site-packages/django/views/generic/base.py", line 70, in view
backend-backend-1   |     return self.dispatch(request, *args, **kwargs)
backend-backend-1   |   File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 509, in dispatch
backend-backend-1   |     response = self.handle_exception(exc)
backend-backend-1   |   File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 469, in handle_exception
backend-backend-1   |     self.raise_uncaught_exception(exc)
backend-backend-1   |   File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
backend-backend-1   |     raise exc
backend-backend-1   |   File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 506, in dispatch
backend-backend-1   |     response = handler(request, *args, **kwargs)
backend-backend-1   |   File "/usr/local/lib/python3.8/site-packages/drf_yasg/views.py", line 94, in get
backend-backend-1   |     schema = generator.get_schema(request, self.public)
backend-backend-1   |   File "/home/app/web/project/shared/urls.py", line 10, in get_schema
backend-backend-1   |     schema = super().get_schema(request, public)
backend-backend-1   |   File "/usr/local/lib/python3.8/site-packages/drf_yasg/generators.py", line 246, in get_schema
backend-backend-1   |     paths, prefix = self.get_paths(endpoints, components, request, public)
backend-backend-1   |   File "/usr/local/lib/python3.8/site-packages/drf_yasg/generators.py", line 404, in get_paths
backend-backend-1   |     operation = self.get_operation(view, path, prefix, method, components, request)
backend-backend-1   |   File "/usr/local/lib/python3.8/site-packages/drf_yasg/generators.py", line 446, in get_operation
backend-backend-1   |     operation = view_inspector.get_operation(operation_keys)
backend-backend-1   |   File "/usr/local/lib/python3.8/site-packages/drf_yasg/inspectors/view.py", line 33, in get_operation
backend-backend-1   |     query = self.get_query_parameters()
backend-backend-1   |   File "/usr/local/lib/python3.8/site-packages/drf_yasg/inspectors/view.py", line 291, in get_query_parameters
backend-backend-1   |     natural_parameters = self.get_filter_parameters() + self.get_pagination_parameters()
backend-backend-1   |   File "/usr/local/lib/python3.8/site-packages/drf_yasg/inspectors/base.py", line 408, in get_filter_parameters
backend-backend-1   |     fields += self.probe_inspectors(self.filter_inspectors, 'get_filter_parameters', filter_backend()) or []
backend-backend-1   |   File "/usr/local/lib/python3.8/site-packages/drf_yasg/inspectors/base.py", line 110, in probe_inspectors
backend-backend-1   |     result = method(obj, **kwargs)
backend-backend-1   |   File "/usr/local/lib/python3.8/site-packages/drf_yasg/inspectors/query.py", line 26, in get_filter_parameters
backend-backend-1   |     fields = filter_backend.get_schema_fields(self.view)
backend-backend-1   |   File "/usr/local/lib/python3.8/site-packages/django_filters/rest_framework/backends.py", line 131, in get_schema_fields
backend-backend-1   |     filterset_class = self.get_filterset_class(view, queryset)
backend-backend-1   |   File "/usr/local/lib/python3.8/site-packages/django_filters/rest_framework/backends.py", line 73, in get_filterset_class
backend-backend-1   |     class AutoFilterSet(self.filterset_base):
backend-backend-1   |   File "/usr/local/lib/python3.8/site-packages/django_filters/filterset.py", line 71, in __new__
backend-backend-1   |     new_class.base_filters = new_class.get_filters()
backend-backend-1   |   File "/usr/local/lib/python3.8/site-packages/django_filters/filterset.py", line 351, in get_filters
backend-backend-1   |     filters[filter_name] = cls.filter_for_field(field, field_name, lookup_expr)
backend-backend-1   |   File "/usr/local/lib/python3.8/site-packages/django_filters/filterset.py", line 379, in filter_for_field
backend-backend-1   |     filter_class, params = cls.filter_for_lookup(field, lookup_type)
backend-backend-1   |   File "/usr/local/lib/python3.8/site-packages/django_filters/filterset.py", line 399, in filter_for_lookup
backend-backend-1   |     params = data.get('extra', lambda field: {})(field)
backend-backend-1   |   File "/usr/local/lib/python3.8/site-packages/django_filters/filterset.py", line 152, in <lambda>
backend-backend-1   |     'queryset': remote_queryset(f),
backend-backend-1   |   File "/usr/local/lib/python3.8/site-packages/django_filters/filterset.py", line 51, in remote_queryset
backend-backend-1   |     return model._default_manager.complex_filter(limit_choices_to)
backend-backend-1   | AttributeError: 'str' object has no attribute '_default_manager'

Not sure what happens here.

Try using drf-spectacular, i'm using it successfully with this project.

Or you can debug you issue and send PR.