Skip to main content
# Django payload validator
This package can validate data provided as payload in request body. This is similar to django forms, but only difference being this works on json data provided throuogh body of a request rather than HTML forms.

### installation

- #### from pypi
- ```pip install django-payload-validator```
- #### from this github repo
- ```pip install -e git+https://github.com/gladsonvm/django_payload_validator.git#egg=django_payload_validator```

### Usage

```
class TeamCreateView(BaseValidatorView):
model = <model>
validation_rule = <validation_rule>
```

### Example

```
class TeamCreateView(BaseValidatorView):
model = Team
validation_rule = create_team
```

### Concepts:

- ##### validation_rule
- A validation rule defines all fields those are meant to be validated.
- Validation rule is a dictionary which defines
* fields
* all fields those are meant to be validated as a dict. Each fields must define its `type`. If a field is mandatory, then set `required` param to true in field declaration.
* auto populated fields
* Fields those are not obtained from request data and must be updated in database.
* excluded fields
* Fields that should not be displayed in response.

example:
```
create_team = {
'fields': {
'name': {'type': str, 'required': True},
'description': {'type': str, 'required': True},
'team_type': {'type': str, 'required': True, 'allowed_values': ['tech', 'management', 'business', 'marketing']},
'members': {'type': list}
},
'auto_populate_fields': {'created_by': 'request.user', 'last_updated_by': 'request.user'},
'excluded_fields': ['members']
}
```

Metadata

Release files for django-payload-validator 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-payload-validator 1.0.1
File Size Uploaded Provenance
django_payload_validator-1.0.1.tar.gz 4.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-payload-validator 1.0.1
File Interpreter ABI Platform
django_payload_validator-1.0.1-py3.6.egg Legacy Egg format - - Details

Total release size: 18.5 kB

Release files / django_payload_validator-1.0.1.tar.gz

Download URL django_payload_validator-1.0.1.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4dcd487019c9ee06e43264ee1e0fed805f1d50632e998a2dad9ef00d7273e83c
BLAKE2b-256 checksum
How to use checksums
73c717b0d15d01be81e163b249054b27fffb29c404ffcec9b135481824641fbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_payload_validator-1.0.1-py3.6.egg

Download URL django_payload_validator-1.0.1-py3.6.egg
Size 13.6 kB
Tags Egg
SHA-256 checksum
How to use checksums
e86b824a087c685911e448275b38b39ab3e3dcf264fb768ad05fbafc200a39ec
BLAKE2b-256 checksum
How to use checksums
6e1838af851a3632b983726009076eea9749298423eac55e7e72fdcea8d65e9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-payload-validator 1.0.1

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.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page