Closed
Description
When I define ordering fields with my ModelViewSet ...
ordering_fields = ("id", "group",)
And my serializer has ...
group = serializers.CharField(source="category", read_only=True)
I expect this ordering field to either work or be ignored. Currently, an exception is being returned ...
django.core.exceptions.FieldError
...
FieldError: Cannot resolve keyword u'group' into field. Choices are: ...
I tried to track this down and had to stop at filters.py, line 158. It seems that remove_invalid_fields
always compares the defined ordering_fields to itself (maybe that´s intentional).
https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/filters.py#L158
Metadata
Metadata
Assignees
Labels
No labels