django-bootstrap5
django-bootstrap5 copied to clipboard
Customizing validation on specific fields or form
I tried to disable validation of a form or it's specific fields. but it seems that django-bootstrap5 forces validation for all bound forms: https://github.com/zostera/django-bootstrap5/blob/fa61c349d4c02db617e7b18e53c23898fb0d7cc3/src/django_bootstrap5/renderers.py#L426
- I tried to remove 'is-valid' from my form object, but the validation css class is added before rendering.
- I can use
server_side_validationin django-bootstrap5 settings but it's global and I don't want to stop validating other forms.
I suggest adding a new parameter to template tags responsible for rendering forms and fields. E.g. {% bootstrap_form form server_side_validation=False %}.
I found myself with the same problem. However it seemed easy to implement, I opened a PR with this feature.
@suspiciousRaccoon is PR accepted?
已收到,谢谢!