Title: Django model fields do not raise the correct error · Issue #157 · rbarrois/python-semanticversion · GitHub
Open Graph Title: Django model fields do not raise the correct error · Issue #157 · rbarrois/python-semanticversion
X Title: Django model fields do not raise the correct error · Issue #157 · rbarrois/python-semanticversion
Description: VersionField and SpecField both raise a ValueError exception when an incorrect value is passed to Version constructor or BaseSpec.parse function. The documentation in django for create custom models fields says https://docs.djangoproject...
Open Graph Description: VersionField and SpecField both raise a ValueError exception when an incorrect value is passed to Version constructor or BaseSpec.parse function. The documentation in django for create custom model...
X Description: VersionField and SpecField both raise a ValueError exception when an incorrect value is passed to Version constructor or BaseSpec.parse function. The documentation in django for create custom model...
Opengraph URL: https://github.com/rbarrois/python-semanticversion/issues/157
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Django model fields do not raise the correct error","articleBody":"[VersionField](https://github.com/rbarrois/python-semanticversion/blob/master/semantic_version/django_fields.py#L48C7-L48C19) and [SpecField](https://github.com/rbarrois/python-semanticversion/blob/master/semantic_version/django_fields.py#L84) both raise a ValueError exception when an incorrect value is passed to Version constructor or BaseSpec.parse function. \r\n\r\nThe documentation in django for create custom models fields says https://docs.djangoproject.com/en/5.0/howto/custom-model-fields/#converting-values-to-python-objects:\r\n\u003e For to_python(), if anything goes wrong during value conversion, you should raise a [ValidationError](https://docs.djangoproject.com/en/5.0/ref/exceptions/#django.core.exceptions.ValidationError) exception.\r\n\r\nI discover this error making a ModelForm from a model that included a VersionField field. Raising a ValueError makes the form crash instead of handle the error gracefully.","author":{"url":"https://github.com/daniboygg","@type":"Person","name":"daniboygg"},"datePublished":"2024-06-27T11:57:36.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/157/python-semanticversion/issues/157"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c9634996-255f-b719-8298-2e97187982b6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A988:202BCA:263FD04:309D11E:6991A2AD |
| html-safe-nonce | 6378a6c3e27c5cad4b5f92702235322d0208a381da393c8df6c1864ffa8a2ff7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOTg4OjIwMkJDQToyNjNGRDA0OjMwOUQxMUU6Njk5MUEyQUQiLCJ2aXNpdG9yX2lkIjoiMTM0OTIyNjk4NTI1NjIzMTU5NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 99e092409aa8d7b9a488e4b2660721ace62dd68d3884b5a42b02b24ce61e96dd |
| hovercard-subject-tag | issue:2377956119 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/rbarrois/python-semanticversion/157/issue_layout |
| twitter:image | https://opengraph.githubassets.com/98ca54169bf09614545359de7801cfc0965375d040011dc5276c7b7c2e3aecfc/rbarrois/python-semanticversion/issues/157 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/98ca54169bf09614545359de7801cfc0965375d040011dc5276c7b7c2e3aecfc/rbarrois/python-semanticversion/issues/157 |
| og:image:alt | VersionField and SpecField both raise a ValueError exception when an incorrect value is passed to Version constructor or BaseSpec.parse function. The documentation in django for create custom model... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | daniboygg |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/rbarrois/python-semanticversion git https://github.com/rbarrois/python-semanticversion.git |
| octolytics-dimension-user_id | 694541 |
| octolytics-dimension-user_login | rbarrois |
| octolytics-dimension-repository_id | 4326308 |
| octolytics-dimension-repository_nwo | rbarrois/python-semanticversion |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 4326308 |
| octolytics-dimension-repository_network_root_nwo | rbarrois/python-semanticversion |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 848bc6032dcc93a9a7301dcc3f379a72ba13b96e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width