Skip to content

feat: refactor views to use DRF status codes, consistent responses, a… #67

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alloy77
Copy link

@alloy77 alloy77 commented Jun 19, 2025

…nd serializer validation
This pull request refactors the application’s views to:

  • Use Django REST Framework’s status codes for all responses
  • Ensure consistent use of Response objects
  • Improve error handling by catching specific exceptions
  • Validate input data using serializers for both creation and updates
  • Remove unnecessary imports and redundant code
    These changes enhance code readability, maintainability, and API reliability.

…nd serializer validation

Signed-off-by: AyushmanPanigrahi <ayushmanayp@gmail.com>
@pratik-mahalle
Copy link

Hey @alloy77, Thank you for raising the pr. Our team will review the changes soon.

Copy link

@pratik-mahalle pratik-mahalle left a comment

Choose a reason for hiding this comment

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

Great refactor! Here are a few suggestions to further improve the code:

You’ve switched to using DRF’s Response and appropriate status codes, which is excellent. However, consider returning more informative error messages for validation errors (in POST/PUT) rather than just the serializer errors, especially if they could be nested or unclear to API consumers.

@pratik-mahalle
Copy link

Overall good pr @alloy77

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