An extension of the django-generic-contact that provides REST endpoints for the Contact model.
Project description
DRF Generic Contact
An extension of the django-generic-contact that provides a POST endpoint to create new instances for
the Contact
model via HTTP.
Installation
pip install drf-generic-contact
Make sure the main module django-generic-contact is part of the INSTALLED_APPS.
Usage
Add the ContactViewSet
to your project's urls.py
, e.g.:
from drf_generic_contact.rest.views import ContactViewSet
router = get_api_router()
router.register(r"contact", ContactViewSet)
urlpatterns = [
...
path("", include(router.urls)),
]
See tests/testapp
for exemplary usage.
Unit Tests
See folder tests/. The provided tests cover these criteria:
- success:
- add new contact via HTTP POST request
- failure:
- HTTP GET request to read contact list
- HTTP GET request to read single contact
- HTTP PUT request to update contact
- HTTP PATCH request to update contact
Follow below instructions to run the tests.
You may exchange the installed Django and DRF versions according to your requirements.
:warning: Depending on your local environment settings you might need to explicitly call python3
instead of python
.
# install dependencies
python -m pip install --upgrade pip
pip install -r requirements.txt
# setup environment
pip install -e .
# run tests
cd tests && python manage.py test
Contributing
Contributions are welcomed! Read the Contributing Guide for more information.
Licensing
See LICENSE for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file drf_generic_contact-1.1.0.tar.gz
.
File metadata
- Download URL: drf_generic_contact-1.1.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06bc9df34aaf80064af73c2ca38029d8208fe76b654f63c99d21fa1218cc7f31 |
|
MD5 | f67dcc5e6306f6e316656b69c4a370a4 |
|
BLAKE2b-256 | 481e9b55dcbf6b13a28b494d0c1e7ede78b7542674e8872b03372ee933e0da5b |
File details
Details for the file drf_generic_contact-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: drf_generic_contact-1.1.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a7b0343e2b2abd67451b799abd83bbdedfa933a93879d9864db2dcec358029c |
|
MD5 | e06453abe4a32358817e5297b0ea165c |
|
BLAKE2b-256 | ac95b06a04533169359899029a67db8df7422541b47e1172b6789c67e30ff382 |