Skip to content
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

Adding media_type in JWTAuthentication #426

Merged
merged 1 commit into from
Jun 27, 2021

Conversation

lizn520
Copy link
Contributor

@lizn520 lizn520 commented Jun 22, 2021

The drf render BrowsableAPIRenderer is requiring
a media_type object when generating a generic form
that includes a content type field, error will occur
if JWTAuthentication class does't have media_type.

The drf render BrowsableAPIRenderer is requiring
a media_type object when generating a generic form
that includes a content type field, error will occur
if JWTAuthentication class does't have media_type.
@lizn520
Copy link
Contributor Author

lizn520 commented Jun 22, 2021

Error occur in D:\Python\Python39\lib\site-packages\rest_framework\renderers.py

class BrowsableAPIRenderer(BaseRenderer):
...
def get_raw_data_form(self, data, view, method, request):
...
# Generate a generic form that includes a content type field,
# and a content field.
media_types = [parser.media_type for parser in view.parser_classes]
choices = [(media_type, media_type) for media_type in media_types]
initial = media_types[0]
...

Copy link
Member

@Andrew-Chen-Wang Andrew-Chen-Wang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

@Andrew-Chen-Wang Andrew-Chen-Wang merged commit b06723f into jazzband:master Jun 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants