Skip to main content

Django Rest Error Inherits Error Messages

ModelSerializer inherits the error_messages of the model

Example

pip install django-rest-inherits-error-messages

Set error_messages in your model field. models.py

class TestModel(django.db.models.Model):
    id = models.BigAutoField(primary_key=True)
    name = models.CharField(max_length=10, error_messages={'required':'[test] This field is required.'})

Go to your ModelSerializer and inherit the InheritsModelSerializer (InheritsHyperlinkedModelSerializer also exists)

class TestSerializer(InheritsModelSerializer):
    class Meta:
        model = TestModel
        fields = '__all__'

If set as above, error_messages will be inherited.

Contributions

Issues and PR are welcome.

Release files for django-rest-inherits-error-messages 1.0.0

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-rest-inherits-error-messages 1.0.0
File Size Uploaded
django-rest-inherits-error-messages-1.0.0.tar.gz 2.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-rest-inherits-error-messages 1.0.0
File Interpreter ABI Platform
django_rest_inherits_error_messages-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 5.4 kB

Release files / django-rest-inherits-error-messages-1.0.0.tar.gz

Download URL django-rest-inherits-error-messages-1.0.0.tar.gz
Size 2.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8438871f99c08e990fec34d6319ce2dc414bd84c6efc103c46093eb0e4b36750
BLAKE2b-256 checksum
How to use checksums
abbccf77d866424b5181c5192cb7669072e44eba4aad78e07e1b0c9c871b8062
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.5

Release files / django_rest_inherits_error_messages-1.0.0-py3-none-any.whl

Download URL django_rest_inherits_error_messages-1.0.0-py3-none-any.whl
Size 2.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
93d52f5c6160af54839f7e125f6ed248fa9b3d783afd92f6dbfba6f9c24283b8
BLAKE2b-256 checksum
How to use checksums
f78c8820ef9a753a0159d0ab507eb8d4d2761dec364882a14756cb8615d9d62a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.5

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

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