Skip to content

Format field names for metadata (OPTIONS request) #500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions rest_framework_json_api/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from rest_framework.settings import api_settings
from rest_framework.utils.field_mapping import ClassLookupDict

from rest_framework_json_api.utils import get_related_resource_type
from rest_framework_json_api.utils import get_related_resource_type, format_value


class JSONAPIMetadata(SimpleMetadata):
Expand Down Expand Up @@ -83,7 +83,7 @@ def get_serializer_info(self, serializer):
serializer.fields.pop(api_settings.URL_FIELD_NAME, None)

return OrderedDict([
(field_name, self.get_field_info(field))
(format_value(field_name), self.get_field_info(field))
for field_name, field in serializer.fields.items()
])

Expand Down