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

Update Response #9668

Closed
wants to merge 2 commits into from
Closed

Update Response #9668

wants to merge 2 commits into from

Conversation

chinmayroy
Copy link

Note: Before submitting a code change, please review our contributing guidelines.

Description

I have solved the message value return issue. And added camel case method to return json response field in camel case. I have also added status code list to check status and return the status as per response status.

Update response to get camel case and modified attribute value
@ulgens
Copy link

ulgens commented Mar 23, 2025

Is this coming from an AI model? The changes don't look like they're aiming a certain fix.

from rest_framework import status

# Function to convert snake_case string to camelCase
def camel_case(snake_str):
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the share.

@chinmayroy
Copy link
Author

Is this coming from an AI model? The changes don't look like they're aiming a certain fix.

I did it by myself. I have got a great solution from @browniebroke.

@chinmayroy
Copy link
Author

I did this change because of message return null.

{ 'code': code, 'status': status, 'data': {}, 'message': null }

I also tried to update message value by
Return Response(data, "custom message", status)

but it is not working . Message always return null.

Could you please help me to update message null to my targeted custom message.

Copy link
Author

@chinmayroy chinmayroy left a comment

Choose a reason for hiding this comment

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

Message null returning issue solved. Please consider to approve the update. then I will be able to use Response instead of custom response method.

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.

3 participants