django-decorators-inkar


Namedjango-decorators-inkar JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/furkankok/inkar
SummaryUseful decorators for Django views
upload_time2023-12-07 22:26:21
maintainer
docs_urlNone
authorFurkan Koksal
requires_python
license
keywords
VCS
bugtrack_url
requirements django
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Django Decorators

This Python package provides a collection of decorators for Django views to streamline handling of request types and parameters.

## Installation

You can install the package using pip:

```shell
pip install django-decorators
```

## Usage

Import the desired decorators from the package and apply them to your view functions:

```python
from django.http import HttpResponse
from decorators import pass_only_get, pass_json_body

@pass_only_get
def my_view(request):
    # Your view logic
    return HttpResponse('Only GET requests are processed.')
```

## Features

- `pass_only_get`: Ensures that the view only processes GET requests.
- `pass_only_post`: Ensures that the view only processes POST requests.
- `pass_only_post_and_get`: Ensures that the view only processes POST and GET requests.
- `pass_json_body`: Parses and validates JSON request bodies.

## Config

You can pass parameters to check types and values of request parameters. The following parameters are available:

- `check_type=False`: Checks parameters type, if set True. (Default: False), it throws `TypeError` if the type is not matched.
- `check_value=HttpResponse`: Checks parameters type if set HttpResponse. It throws `HttpResponse` if the value is not matched.
- `check_value=Exception`: You can customize your own exception class. It throws your exception if the value is not matched.


## Contributing

Contributions are welcome! For major changes, please open an issue first to discuss what you would like to change.

## License

This project is licensed under the MIT License - see the LICENSE file for details.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/furkankok/inkar",
    "name": "django-decorators-inkar",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Furkan Koksal",
    "author_email": "furkankoksaldi28@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/07/81/745ee33e9af92cf17338f5934bb9b123d2ac598b3a365ff15e0e3383fd12/django-decorators-inkar-0.1.0.tar.gz",
    "platform": null,
    "description": "\r\n# Django Decorators\r\n\r\nThis Python package provides a collection of decorators for Django views to streamline handling of request types and parameters.\r\n\r\n## Installation\r\n\r\nYou can install the package using pip:\r\n\r\n```shell\r\npip install django-decorators\r\n```\r\n\r\n## Usage\r\n\r\nImport the desired decorators from the package and apply them to your view functions:\r\n\r\n```python\r\nfrom django.http import HttpResponse\r\nfrom decorators import pass_only_get, pass_json_body\r\n\r\n@pass_only_get\r\ndef my_view(request):\r\n    # Your view logic\r\n    return HttpResponse('Only GET requests are processed.')\r\n```\r\n\r\n## Features\r\n\r\n- `pass_only_get`: Ensures that the view only processes GET requests.\r\n- `pass_only_post`: Ensures that the view only processes POST requests.\r\n- `pass_only_post_and_get`: Ensures that the view only processes POST and GET requests.\r\n- `pass_json_body`: Parses and validates JSON request bodies.\r\n\r\n## Config\r\n\r\nYou can pass parameters to check types and values of request parameters. The following parameters are available:\r\n\r\n- `check_type=False`: Checks parameters type, if set True. (Default: False), it throws `TypeError` if the type is not matched.\r\n- `check_value=HttpResponse`: Checks parameters type if set HttpResponse. It throws `HttpResponse` if the value is not matched.\r\n- `check_value=Exception`: You can customize your own exception class. It throws your exception if the value is not matched.\r\n\r\n\r\n## Contributing\r\n\r\nContributions are welcome! For major changes, please open an issue first to discuss what you would like to change.\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the LICENSE file for details.\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Useful decorators for Django views",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/furkankok/inkar"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "11271e7ca58e2d2beb4cfd58d6ee83a505d7e089e15130b40ccaf131a316c59a",
                "md5": "e2ffb47ee46fe312990db6b938211c95",
                "sha256": "d7cd3a37d12bf0a320ca167f0c542c680f935ed0628f0474c8e12d12a458e743"
            },
            "downloads": -1,
            "filename": "django_decorators_inkar-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e2ffb47ee46fe312990db6b938211c95",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 2837,
            "upload_time": "2023-12-07T22:26:19",
            "upload_time_iso_8601": "2023-12-07T22:26:19.799218Z",
            "url": "https://files.pythonhosted.org/packages/11/27/1e7ca58e2d2beb4cfd58d6ee83a505d7e089e15130b40ccaf131a316c59a/django_decorators_inkar-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0781745ee33e9af92cf17338f5934bb9b123d2ac598b3a365ff15e0e3383fd12",
                "md5": "997e410c33f7882e8c134258e138cc2f",
                "sha256": "2ea7e85dbecd14476688b746ff01b6156a0b105afd63f0889a6075f7515f4a9e"
            },
            "downloads": -1,
            "filename": "django-decorators-inkar-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "997e410c33f7882e8c134258e138cc2f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 2623,
            "upload_time": "2023-12-07T22:26:21",
            "upload_time_iso_8601": "2023-12-07T22:26:21.466673Z",
            "url": "https://files.pythonhosted.org/packages/07/81/745ee33e9af92cf17338f5934bb9b123d2ac598b3a365ff15e0e3383fd12/django-decorators-inkar-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-07 22:26:21",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "furkankok",
    "github_project": "inkar",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "django",
            "specs": [
                [
                    ">=",
                    "4.0"
                ]
            ]
        }
    ],
    "lcname": "django-decorators-inkar"
}
        
Elapsed time: 0.19601s