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.
Metadata
Release files for drf-generic-contact 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| drf_generic_contact-1.2.0.tar.gz | 8.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| drf_generic_contact-1.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.1 kB
Release files / drf_generic_contact-1.2.0.tar.gz
| Download URL | drf_generic_contact-1.2.0.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9a452b5117542527c3b676c9703421f48058667d7c255396de04f35ded61c882
|
|
BLAKE2b-256 checksum How to use checksums |
2d3900950eed9a42fffebdee61172d46176bbafadafcecc719ec987178b4a85b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / drf_generic_contact-1.2.0-py3-none-any.whl
| Download URL | drf_generic_contact-1.2.0-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c8bc29984fdbb3e591c6a6b7aa85f87380440e3be6f61fe3bdeac4f8d9ccb3a7
|
|
BLAKE2b-256 checksum How to use checksums |
ff874af245f8d0c164bf4ae8f7cf9e968f23fe11af6f0f2ad32d946ff835d5b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|