We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bootstrap allows the use of is-valid and is-invalid for fields of validated forms (bounded). Whereas is-invalid class can be easily added as
is-valid
is-invalid
{% render_field form.field1|add_error_class:'is-invalid' %}
It is not easy to do so with is-valid because blindly adding the class will mark fields as valid for unbounded forms.
Is it possible to add another filter called add_valid_class as follows?
add_valid_class
@register.filter("add_valid_class") @silence_without_field def add_valid_class(field, css_class): if field.form.is_bound and not (hasattr(field, "errors") and field.errors): return add_class(field, css_class) return
I suppose it also makes sense to add WIDGET_VALID_CLASS so that I can do
WIDGET_VALID_CLASS
{% with WIDGET_ERROR_CLASS='is-invalid' WIDGET_VALID_CLASS="is-valid" %} {% render_field form.field1 %} {% render_field form.field2 %} {% render_field form.field3 %} {% endwith %}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
bootstrap allows the use of
is-valid
andis-invalid
for fields of validated forms (bounded). Whereasis-invalid
class can be easily added asIt is not easy to do so with
is-valid
because blindly adding the class will mark fields as valid for unbounded forms.Is it possible to add another filter called
add_valid_class
as follows?I suppose it also makes sense to add
WIDGET_VALID_CLASS
so that I can doThe text was updated successfully, but these errors were encountered: