{"id":28138475,"url":"https://github.com/giuseppenovielli/drf-fullclean","last_synced_at":"2025-08-10T16:42:22.542Z","repository":{"id":254102067,"uuid":"845434339","full_name":"giuseppenovielli/drf-fullclean","owner":"giuseppenovielli","description":"Call django model full_clean() when invoke serializer.is_valid() of ModelSerializer.","archived":false,"fork":false,"pushed_at":"2024-09-10T07:59:56.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-04T16:47:37.981Z","etag":null,"topics":["djangorestframework","modelvalidation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/giuseppenovielli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-21T08:42:52.000Z","updated_at":"2024-09-10T07:59:59.000Z","dependencies_parsed_at":"2024-09-09T16:36:23.321Z","dependency_job_id":"e734ee53-b0ad-4157-bbed-80d116f458ea","html_url":"https://github.com/giuseppenovielli/drf-fullclean","commit_stats":null,"previous_names":["giuseppenovielli/drf-fullclean"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/giuseppenovielli/drf-fullclean","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giuseppenovielli%2Fdrf-fullclean","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giuseppenovielli%2Fdrf-fullclean/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giuseppenovielli%2Fdrf-fullclean/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giuseppenovielli%2Fdrf-fullclean/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/giuseppenovielli","download_url":"https://codeload.github.com/giuseppenovielli/drf-fullclean/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giuseppenovielli%2Fdrf-fullclean/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269755487,"owners_count":24470536,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["djangorestframework","modelvalidation"],"created_at":"2025-05-14T17:14:20.448Z","updated_at":"2025-08-10T16:42:22.470Z","avatar_url":"https://github.com/giuseppenovielli.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# drf-fullclean\n![PyPI - Version](https://img.shields.io/pypi/v/drf-fullclean)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/drf-fullclean)\n\n**Call django Model.full_clean(exclude=None, validate_unique=True) when invoke serializer.is_valid() of ModelSerializer**\n\n### Django Rest Framework 3 Design\nhttps://www.django-rest-framework.org/community/3.0-announcement/#differences-between-modelserializer-validation-and-modelform\n### Differences between ModelSerializer validation and ModelForm.\n\u003e This change also means that we no longer use the .full_clean() method on model instances, but instead perform all validation explicitly on the serializer. This gives a cleaner separation, and ensures \u003e that there's no automatic validation behavior on ModelSerializer classes that can't also be easily replicated on regular Serializer classes.\n\n### Discussions\nhttps://github.com/encode/django-rest-framework/discussions/7850\n\n## Warning!\n1. One ModelSerializer -\u003e Use this library.\n2. Multiple ModelSerializer -\u003e [PLEASE READ ME](https://github.com/giuseppenovielli/drf-fullclean/discussions/4)\n\n## Installation\n```\npip install drf-fullclean\n```\n\n## Configuration\nAdd the following code into settings.py\n```\nDRF_FULL_CLEAN = {\n    \"DEBUG\" : False #set True if you want to see debug print\n}\n```\n\n## Usage\n```\nfrom drf_fullclean.serializers import FullCleanModelSerializer\n\nclass MyModelSerializerClass(FullCleanModelSerializer):\n  class Meta:\n      model = MyModel\n      fields = '__all__\n```\n\n```\ns = MyModelSerializerClass(data=request.POST)\ns.is_valid(raise_exception=True)\ns.save()\n```\nWhen you call `s.is_valid(raise_exception=True)` this method invoke also Model.full_clean() method.\n\n**The validation FAIL IF Model.full_clean() FAIL.**\n\n## API\n`is_valid()` is extended with Model.full_clean() api.\n\n```\nis_valid(self, raise_exception=False, exclude=None, validate_unique=True, extra_include=None, *args, **kwargs)\n```\n  + [raise_exception=False](https://www.django-rest-framework.org/api-guide/serializers/#raising-an-exception-on-invalid-data)\n  + [exclude=None](https://docs.djangoproject.com/en/3.2/ref/models/instances/#django.db.models.Model.full_clean)\n  + [validate_unique=True](https://docs.djangoproject.com/en/3.2/ref/models/instances/#django.db.models.Model.full_clean)\n  + [extra_include=None](https://github.com/giuseppenovielli/drf-fullclean/discussions/4)\n  \n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiuseppenovielli%2Fdrf-fullclean","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgiuseppenovielli%2Fdrf-fullclean","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiuseppenovielli%2Fdrf-fullclean/lists"}