drfrf
Django REST framework - redux-form connector
Installation
$ pipenv install drfrf
Usage
Import and use one of ValidateCreateMixin or ValidateUpdateMixin:
from drfrf import ValidateCreateMixin, ValidateUpdateMixin
from rest_framework import viewsets
from rest_framework.decorators import detail_route, list_route
from shop.models import CartItem
from shop.serializers import CartItemSerializer
class CartItemViewSet(ValidateCreateMixin, ValidateUpdateMixin, viewsets.ModelViewSet):
queryset = CartItem.objects.all()
serializer_class = CartItemSerializer
@list_route(methods=["post"], url_path="validate")
def validate_list(self, request):
return self.validate_create(request)
@detail_route(methods=["post"], url_path="validate")
def validate_detail(self, request, **kwargs):
return self.validate_update(request, **kwargs)
Posting invalidate data to /items/validate would return error messages:
HTTP/1.1 400 Bad Request
Content-Length: 99
Content-Type: application/json
{
"amount": [
"Your current credit is 36€, please top-up your account before adding to your cart."
]
}
Browse the complete example here: https://github.com/Theodo-UK/drfrf/tree/master/example/backend/shop
API
ValidateCreateMixin
Exposes one method: validate_create takes Request, validates the input data against the provided serializer and returns a Response.
ValidateUpdateMixin
Exposes one method: validate_update takes Request with kwargs, validates the input data against the provided serializer and returns a Response.
Frontend integration
If you're using redux-form in your frontend, check out drfrf for the front.
Metadata
Release files for drfrf 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| drfrf-0.0.2.tar.gz | 3.1 kB | Without provenance | Details for drfrf-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| drfrf-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for drfrf-0.0.2-py3-none-any.whl |
Total release size: 7.0 kB
Release files / drfrf-0.0.2.tar.gz
| Download URL | drfrf-0.0.2.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12f301878e61a0d2d20091c1d9bf3e62bb3ed7480f9141fc8539c8160f4bdeae
|
|
BLAKE2b-256 checksum How to use checksums |
0bf0f0178c17bfa6fa08cec23afcdb23b24638afee1477a18238a500f7058d54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0
|
Release files / drfrf-0.0.2-py3-none-any.whl
| Download URL | drfrf-0.0.2-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc1a8499e68bf882829832c9cf4e54880e659102f084248cab1cb044badc6d59
|
|
BLAKE2b-256 checksum How to use checksums |
e1d77deb0844694b2225fa91e18572012246c8f9cde715b177f3765fdf7d588c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0
|
Security for drfrf 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.