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
I am trying to style a Submit button with a css_class of btn btn-outline-primary from Boostrap4.
Submit
css_class
btn btn-outline-primary
However, when I pass css_class='btn btn-outline-primary' into a Submit button, the rendered result is not as expected.
css_class='btn btn-outline-primary'
It appears that both the primary and primary outline classes are being rendered on top of each other.
This seems to be related to the following where the css_class is defaulted to btn btn-primary and the css_class passed into Submit is appended to it.
btn btn-primary
https://github.com/django-crispy-forms/django-crispy-forms/blob/1.14.0/crispy_forms/layout.py#L213 https://github.com/django-crispy-forms/django-crispy-forms/blob/1.14.0/crispy_forms/layout.py#L183-L184
Thanks!
from crispy_forms.layout import Submit Submit( 'submit', 'Save', css_class='btn btn-outline-primary', )
Result
Expected
<input type="submit" name="submit" value="Save" class="btn btn-primary btn btn-outline-primary" id="submit-id-submit">
<input type="submit" name="submit" value="Save" class="btn btn-outline-primary" id="submit-id-submit">
The text was updated successfully, but these errors were encountered:
I think the current advice here would be to subclass the Submit button and add your custom field_classes.
field_classes
Sorry, something went wrong.
No branches or pull requests
Description:
I am trying to style a
Submit
button with acss_class
ofbtn btn-outline-primary
from Boostrap4.However, when I pass
css_class='btn btn-outline-primary'
into aSubmit
button, the rendered result is not as expected.It appears that both the primary and primary outline classes are being rendered on top of each other.
This seems to be related to the following where the
css_class
is defaulted tobtn btn-primary
and thecss_class
passed intoSubmit
is appended to it.https://github.com/django-crispy-forms/django-crispy-forms/blob/1.14.0/crispy_forms/layout.py#L213
https://github.com/django-crispy-forms/django-crispy-forms/blob/1.14.0/crispy_forms/layout.py#L183-L184
Thanks!
Preferably also include:
Result
Expected
The text was updated successfully, but these errors were encountered: