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 an POST endpoints to create new instances for
the Contact
model via HTTP.
Installation
-
Install django-generic-contact by following the installation instructions.
-
Install drf-generic-contact using pip:
pip install drf-generic-contact
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
Hashes for drf-generic-contact-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a265b7a98461f0aa7a5f43ca390ee4ba56aff6d87ce6259403a5ae4fb2f4722b |
|
MD5 | 9319e80c36f68df16265003882c8d4db |
|
BLAKE2b-256 | 13ef86dbf5834a3396da026d5985677118ca1190ca82f15300e09dcadbaa4411 |
Hashes for drf_generic_contact-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f0d92a482d3b0ca7a94d98266a207cd4d47b51b19330c7186d0fe35ce74581a |
|
MD5 | a8dc2d948ba0d3af02dc48c5282e6535 |
|
BLAKE2b-256 | d4c08d9e4428c1786cff41cc4f0eba6c218b093de0cd657a8f812eb696bf114d |