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 -e ".[test]"
# 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
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file drf_generic_contact-1.2.0.tar.gz.
File metadata
- Download URL: drf_generic_contact-1.2.0.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a452b5117542527c3b676c9703421f48058667d7c255396de04f35ded61c882
|
|
| MD5 |
053de1bc35d2c59c6a6f2a988b25f3bc
|
|
| BLAKE2b-256 |
2d3900950eed9a42fffebdee61172d46176bbafadafcecc719ec987178b4a85b
|
File details
Details for the file drf_generic_contact-1.2.0-py3-none-any.whl.
File metadata
- Download URL: drf_generic_contact-1.2.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8bc29984fdbb3e591c6a6b7aa85f87380440e3be6f61fe3bdeac4f8d9ccb3a7
|
|
| MD5 |
96d6a86b4093d4a3bc4279c395f71195
|
|
| BLAKE2b-256 |
ff874af245f8d0c164bf4ae8f7cf9e968f23fe11af6f0f2ad32d946ff835d5b8
|