{"id":15387166,"url":"https://github.com/wildhoney/djangoexceptions","last_synced_at":"2025-03-27T23:14:58.731Z","repository":{"id":57213216,"uuid":"94637751","full_name":"Wildhoney/DjangoExceptions","owner":"Wildhoney","description":"Handle and parse Django REST Framework validation messages with aplomb. ","archived":false,"fork":false,"pushed_at":"2017-07-12T16:31:47.000Z","size":166,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-04T19:37:10.759Z","etag":null,"topics":["api","django","error","errors","framework","message","messages","rest","validation","validator","validators"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/Wildhoney.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}},"created_at":"2017-06-17T17:04:38.000Z","updated_at":"2023-09-13T23:33:36.000Z","dependencies_parsed_at":"2022-08-24T21:41:56.796Z","dependency_job_id":null,"html_url":"https://github.com/Wildhoney/DjangoExceptions","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wildhoney%2FDjangoExceptions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wildhoney%2FDjangoExceptions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wildhoney%2FDjangoExceptions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wildhoney%2FDjangoExceptions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Wildhoney","download_url":"https://codeload.github.com/Wildhoney/DjangoExceptions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245938228,"owners_count":20697008,"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","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":["api","django","error","errors","framework","message","messages","rest","validation","validator","validators"],"created_at":"2024-10-01T14:52:21.579Z","updated_at":"2025-03-27T23:14:58.704Z","avatar_url":"https://github.com/Wildhoney.png","language":"JavaScript","readme":"\u003cimg alt=\"Django Exceptions\" src=\"media/django-rest-framework.png\" width=\"350\" /\u003e\n\n\u003e Handle and parse [Django REST Framework validation messages](https://docs.djangoproject.com/en/1.11/ref/forms/validation/) with aplomb.\n\n`npm i django-exceptions --save`\n\n![Travis](http://img.shields.io/travis/Wildhoney/DjangoExceptions.svg?style=flat-square)\n\u0026nbsp;\n![Coveralls](https://img.shields.io/coveralls/Wildhoney/DjangoExceptions.svg?style=flat-square)\n\u0026nbsp;\n![npm](http://img.shields.io/npm/v/django-exceptions.svg?style=flat-square)\n\u0026nbsp;\n![License MIT](http://img.shields.io/badge/license-mit-lightgrey.svg?style=flat-square)\n\n# Getting Started\n\nDjango Exceptions will attempt to flatten the validation messages into a single hierarchy, as otherwise the validation messages are infinitely nested, which makes it troublesome to render to HTML. Thus you are guanrateed to have a single array of all validation messages, with a `field` and `messages` key \u0026ndash; both of which themselves are arrays.\n\n```javascript\nimport parse from 'django-exceptions';\n\nconst data = await fromApi();\n\nparse(data).forEach(x =\u003e {\n    console.log('Field:', x.field);\n    console.log('Messages:', x.messages);\n});\n```\n\nIn [React](https://github.com/facebook/react) you *might* do something like the following to render the messages:\n\n```javascript\nimport parse from 'django-exceptions';\n\nrender() {\n    \n    return (\n        \u003cul className=\"messages\"\u003e\n\n            {parse(this.props.messages).map(x =\u003e (\n                \u003cli\u003e{x.field.join(' → ')}: {x.messages.join(', ')}\u003c/li\u003e\n            ))}\n\n        \u003c/ul\u003e\n    );\n\n}\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwildhoney%2Fdjangoexceptions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwildhoney%2Fdjangoexceptions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwildhoney%2Fdjangoexceptions/lists"}