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
Hashes for drf-generic-contact-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 208908ce6b04802b72fe122be01447fc8d50e953ddc8b803c8efa161842981b3 |
|
MD5 | b930a0517dbee8d6cd41850c77adeb34 |
|
BLAKE2b-256 | ab38656a3d61041a3fc8f750dba9faa198133441ae5f162d424a3d8d1f9ef1d3 |
Hashes for drf_generic_contact-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 132fff3a68ba8f89e4a783e4d4fb4440a27a38228ffa01e82301a4aee271800d |
|
MD5 | 97c1898af266c3167b0cc33cca265f2b |
|
BLAKE2b-256 | 35e674079d5cc33a54d35b08b43df64806a89e2886d393f63602a4ce1a33576e |