Metadata-Version: 2.4
Name: drf-standardized-responses
Version: 0.1.2
Summary: A simple Django app to standardize responses for DRF projects.
Home-page: https://github.com/Yosef-AlSabbah/drf-standardized-responses
Author: Yousef M. Y. Al Sabbah
Author-email: itzyousefalsabbah@gmail.com
Project-URL: Bug Tracker, https://github.com/Yosef-AlSabbah/drf-standardized-responses/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Framework :: Django
Classifier: Framework :: Django :: 3.2
Classifier: Framework :: Django :: 4.0
Classifier: Framework :: Django :: 4.1
Classifier: Framework :: Django :: 4.2
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: django>=2.2
Requires-Dist: djangorestframework>=3.12.0
Dynamic: license-file

# drf-standardized-responses

[![PyPI](https://img.shields.io/pypi/v/drf-standardized-responses.svg)](https://pypi.org/project/drf-standardized-responses/)
[![Downloads](https://static.pepy.tech/personalized-badge/drf-standardized-responses?period=total&units=international_system&left_color=grey&right_color=blue&left_text=Downloads)](https://pepy.tech/project/drf-standardized-responses)
[![Python Version](https://img.shields.io/pypi/pyversions/drf-standardized-responses.svg)](https://pypi.org/project/drf-standardized-responses/)
[![License](https://img.shields.io/badge/license-BSD-blue.svg)](LICENSE)

Standardized responses for Django REST Framework projects.

## Features

- **Consistent Response Format**: All API responses follow a standardized structure.
- **Custom Renderers**: JSON renderer that formats all responses with consistent structure.
- **Pagination**: Standardized pagination with consistent output format.
- **Response Utilities**: Helper functions for creating standard success and error responses.

## Installation

```bash
pip install drf-standardized-responses
```

## Quick Start

Add the necessary components to your Django REST Framework settings:

```python
REST_FRAMEWORK = {
    # Exception handling for consistent error responses
    'EXCEPTION_HANDLER': 'drf_standardized_responses.exceptions.standardized_exception_handler',
    
    # Pagination with standardized format
    'DEFAULT_PAGINATION_CLASS': 'drf_standardized_responses.pagination.StandardizedPageNumberPagination',
    
    # Response rendering for consistent output structure
    'DEFAULT_RENDERER_CLASSES': [
        'drf_standardized_responses.renderers.StandardizedJSONRenderer',
        'rest_framework.renderers.BrowsableAPIRenderer',
    ],
}
```

## Documentation

For more detailed documentation, see the [docs](./docs) directory.

## License

[BSD License](LICENSE)

Copyright (c) 2025, All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
